<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0054)http://blog.csdn.net/qinjuning/article/details/7310620 -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">   
    
     
    <script type="text/javascript" async="" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ga.js"></script><script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/tracking.js" charset="utf-8"></script>  

    <script type="text/javascript">
        var protocol = window.location.protocol;
        document.write('<script type="text/javascript" src="' + protocol + '//csdnimg.cn/pubfooter/js/repoAddr2.js?v=' + Math.random() + '"></' + 'script>');
    </script><script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/repoAddr2.js"></script>

     <script id="allmobilize" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/allmobilize.min.js"></script><style type="text/css"></style>
 <meta http-equiv="Cache-Control" content="no-siteapp"><link rel="alternate" media="handheld" href="http://blog.csdn.net/qinjuning/article/details/7310620#">

    <title>Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go
        - 博客频道 - CSDN.NET</title>
    
    <meta name="description" content="本文原创 ，转载必须注明出处 :http://blog.csdn.net/qinjuning               前言：本文是我读《Android内核剖析》第7章 后形成的读书笔记 ，在此向欲了解Android框架的书籍推荐此书。            大家好，  今天给大家介绍下我们在应用开发中最熟悉而陌生的朋友-----Context类 ，说它熟悉，是应">
    <script src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/jquery.js" type="text/javascript"></script>
    <script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ad.js"></script>
        <!--new top-->
       
        <link rel="stylesheet" href="http://static.csdn.net/public/common/toolbar/css/index.css">
        <!--new top-->

    <link rel="Stylesheet" type="text/css" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/style.css">
    <link id="RSSLink" title="RSS" type="application/rss+xml" rel="alternate" href="http://blog.csdn.net/qinjuning/rss/list">
    <link rel="shortcut icon" href="http://c.csdnimg.cn/public/favicon.ico">
    <link type="text/css" rel="stylesheet" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/blue_green.css">
 


<script src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/share.js"></script><style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 5px 0px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 1px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuArrow.RTL {left: .5em; right: auto}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuCheck.RTL {right: .7em; left: auto}
.MathJax_MenuRadioCheck {position: absolute; left: .7em}
.MathJax_MenuRadioCheck.RTL {right: .7em; left: auto}
.MathJax_MenuLabel {padding: 1px 2em 3px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #DDDDDD; margin: 4px 3px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: #606872; color: white}
.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><link rel="stylesheet" type="text/css" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/job_reco.css"><link rel="stylesheet" type="text/css" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/job_reco.css"><link href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/bdsstyle.css" rel="stylesheet" type="text/css"><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/main.js"></script><script charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/lightapp.js" data-appid="3629560" async="" name="baidu-tc-cerfication"></script><link rel="stylesheet" type="text/css" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/style(1).css"><link type="text/css" rel="stylesheet" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/style(2).css"><script src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/logger.js"></script><script src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/get" async="" type="text/javascript" charset="utf-8"></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/helper-utils-moplus-monitor_7cf38e1.js" _md_="_anymoore_http://apps.bdimg.com/cloudaapi/pkg/helper-utils-moplus-monitor_7cf38e1.js"></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/push-smartBar_30a1dd3.js" _md_="_anymoore_http://apps.bdimg.com/cloudaapi/pkg/push-smartBar_30a1dd3.js"></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/app-socialshare_1c3f0db.js" _md_="_anymoore_http://apps.bdimg.com/cloudaapi/pkg/app-socialshare_1c3f0db.js"></script><link rel="stylesheet" href="http://bdimg.share.baidu.com/static/api/css/share_style0_16.css?v=8105b07e.css"><script src="http://127.0.0.1:7777/weakBindLight?apikey=zGhG9os6hVZxp2KLek3cwIuM&nonce=3UrycbvoX720t53fpx1W&csrftoken=2fae5b3a03a40e2bbdf46ee1cfde7439&channel=clouda&callback=cloudaPushServiceWeakBindLight"></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/account-pay_aef1a13.js" _md_="_anymoore_http://apps.bdimg.com/cloudaapi/pkg/account-pay_aef1a13.js"></script></head>
<body class=" hPC" style=""><iframe frameborder="0" style="display: none;"></iframe><div id="MathJax_Message" style="display: none;"></div>
    
   
      <!--new top-->
    <script id="toolbar-tpl-scriptId" fixed="true" prod="blog" skin="black" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/html.js" type="text/javascript"></script><div class="csdn-toolbar csdn-toolbar-skin-black ">        <div class="container row center-block ">          <div class="col-md-3 pull-left logo clearfix"><a href="http://www.csdn.net/?ref=toolbar" title="CSDN首页" target="_blank" class="icon"></a><a title="频道首页" href="http://blog.csdn.net/?ref=toolbar_logo" target="_blank" class="img blog-icon"></a></div>          <div class="pull-right login-wrap unlogin">            <ul class="btns">              <li class="loginlink"><a href="https://passport.csdn.net/account/login?ref=toolbar" target="_top">登录&nbsp;</a>|<a target="_top" href="https://passport.csdn.net/account/register?ref=toolbar">&nbsp;注册</a></li>              <li class="search">                <div class="icon on-search-icon">                  <div class="wrap">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                    <form action="http://so.csdn.net/search" method="get" target="_blank">                      <input type="hidden" value="toolbar" name="ref" accesskey="2">                      <div class="border">                        <input placeholder="搜索" type="text" value="" name="q" accesskey="2"><span class="icon-enter-sm"></span>                      </div>                    </form>                  </div>                </div>              </li>              <li class="favor">                <div class="icon on-favor-icon">                  <div class="wrap">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                    <div style="display:none;" class="favor-success"><span class="msg">收藏成功</span>                      <div class="btns"><span class="btn btn-primary ok">确定</span></div>                    </div>                    <div style="display:none;" class="favor-failed"><span class="icon-danger-lg"></span><span class="msg">收藏失败，请重新收藏</span>                      <div class="btns"><span class="btn btn-primary ok">确定</span></div>                    </div>                    <form role="form" class="form-horizontal favor-form">                      <div class="form-group">                        <div class="clearfix">                          <label for="input-title" class="col-sm-2 control-label">标题</label>                          <div class="col-sm-10">                            <input id="inputTitle" type="text" placeholder="" class="title form-control">                          </div>                        </div>                        <div class="alert alert-danger"><strong></strong>标题不能为空</div>                      </div>                      <div class="form-group">                        <label for="input-url" class="col-sm-2 control-label">网址</label>                        <div class="col-sm-10">                          <input id="input-url" type="text" placeholder="" class="url form-control">                        </div>                      </div>                      <div class="form-group">                        <label for="input-tag" class="col-sm-2 tag control-label">标签</label>                        <div class="col-sm-10">                          <input id="input-tag" type="text" class="form-control tag">                        </div>                      </div>                      <div class="form-group">                        <label for="input-description" class="description col-sm-2 control-label">摘要</label>                        <div class="col-sm-10">                          <textarea id="input-description" class="form-control description"></textarea>                        </div>                      </div>                      <div class="form-group">                        <div class="col-sm-offset-2 col-sm-10 ft">                          <div class="col-sm-4 pull-left">                            <div class="checkbox">                              <label>                                <input type="checkbox" name="share" checked="checked" class="share">公开                              </label>                            </div>                          </div>                          <div class="col-sm-8 pull-right favor-btns">                            <button type="button" class="cancel btn btn-default">取消</button>                            <button type="submit" class="submit btn btn-primary">收藏</button>                          </div>                        </div>                      </div>                    </form>                  </div>                </div>              </li>              <li class="notify">                <div style="display:none" class="number"></div>                <div style="display:none" class="icon-hasnotes-sm"></div>                <div id="header_notice_num"></div>                <div class="icon on-notify-icon">                  <div class="wrap">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                    <div id="note1" class="csdn_note">                      <div class="box"></div>                    <iframe src="about:block" frameborder="0" allowtransparency="true" style="z-index:-1;position:absolute;top:0;left:0;width:100%;height:100%;background:transparent"></iframe></div>                  </div>                </div>              </li>              <li class="ugc">                <div class="icon on-ugc-icon">                  <div class="wrap clearfix">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                    <dl>                      <dt><a href="http://geek.csdn.net/news/expert?ref=toolbar" target="_blank" class="p-news clearfix" style="display:none;"><em class="icon"></em><span>分享资讯</span></a></dt>                      <dt><a href="http://u.download.csdn.net/upload?ref=toolbar" target="_blank" class="p-doc clearfix"><em class="icon"></em><span>传PPT/文档</span></a></dt>                      <dt><a href="http://bbs.csdn.net/topics/new?ref=toolbar" target="_blank" class="p-ask clearfix"><em class="icon"></em><span>提问题</span></a></dt>                      <dt><a href="http://write.blog.csdn.net/postedit?ref=toolbar" target="_blank" class="p-blog clearfix"><em class="icon"></em><span>写博客</span></a></dt>                      <dt><a href="http://u.download.csdn.net/upload?ref=toolbar" target="_blank" class="p-src clearfix"><em class="icon"></em><span>传资源</span></a></dt>                      <dt><a href="https://code.csdn.net/projects/new?ref=toolbar" target="_blank" class="c-obj clearfix"><em class="icon"></em><span>创建项目</span></a></dt>                      <dt><a href="https://code.csdn.net/snippets/new?ref=toolbar" target="_blank" class="c-code clearfix"><em class="icon"></em><span>创建代码片</span></a></dt>                    </dl>                  </div>                </div>              </li>              <li class="profile">                <div class="icon on-profile-icon"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/100x100.jpg" class="curr-icon-img">                  <div class="wrap clearfix">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                    <div class="bd">                      <dl class="clearfix">                        <dt class="pull-left img"><a target="_blank" href="http://my.csdn.net/?ref=toolbar" class="avatar"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/100x100.jpg"></a></dt>                        <dd class="info" style="border: none;"><a target="_blank" href="http://my.csdn.net/?ref=toolbar" class="nickname"></a><a class="set-nick" href="https://passport.csdn.net/account/profile">设置昵称<span class="write-icon"></span></a><span class="dec"><a class="fill-dec" href="http://my.csdn.net/" target="_blank">编辑自我介绍，让更多人了解你<span class="write-icon"></span></a></span></dd>                      </dl>                    </div>                    <div class="ft clearfix"><a target="_blank" href="http://my.csdn.net/my/account/changepwd?ref=toolbar" class="pull-left"><span class="icon-cog"></span>帐号设置</a><a href="https://passport.csdn.net/account/logout?ref=toolbar" target="_top" class="pull-left" style="margin-left:132px; width:18px; height:27px; white-space:nowrap; overflow:hidden;"><span class="icon-signout"></span><span class="out">退出</span></a></div>                  </div>                </div>              </li>              <li class="apps">                <div id="chasnew123" class="hasnew" style="display: none;"></div>                <div id="cappsarea123" class="icon on-apps-icon">                  <div class="wrap clearfix">                    <div class="curr-icon-wrap">                      <div class="curr-icon"></div>                    </div>                  <div class="detail">                    <dl>                      <dt>                        <h5>社区</h5>                      </dt>                      <dd> <a href="http://blog.csdn.net/?ref=toolbar" target="_blank">博客</a></dd>                      <dd> <a href="http://bbs.csdn.net/?ref=toolbar" target="_blank">论坛</a></dd>                      <dd> <a href="http://download.csdn.net/?ref=toolbar" target="_blank">下载</a></dd>                      <dd><a href="http://ask.csdn.net/?ref=toolbar" target="_blank">技术问答</a></dd>                      <dd><a href="http://geek.csdn.net/?ref=toolbar" target="_blank">极客头条</a></dd>                      <dd> <a href="http://hero.csdn.net/?ref=toolbar" target="_blank">英雄会</a></dd>                    </dl>                  </div>                  <div class="detail">                    <dl>                      <dt>                        <h5>服务</h5>                      </dt>                      <dd> <a href="http://job.csdn.net/?ref=toolbar" target="_blank">JOB<img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/new.gif" style="display: none; margin-top: -26px; width: 23px;"></a></dd>                      <dd> <a href="http://edu.csdn.net/?ref=toolbar" target="_blank">学院<img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/new.gif" style="display: none; margin-top: -26px; width: 23px;"></a></dd>                      <dd> <a href="https://code.csdn.net/?ref=toolbar" target="_blank">CODE</a></dd>                      <dd> <a href="http://huiyi.csdn.net/?ref=toolbar" target="_blank">活动</a></dd>                      <dd> <a href="http://www.csto.com/?ref=toolbar" target="_blank">CSTO</a></dd>                      <dd> <a href="http://mall.csdn.net/?ref=toolbar" target="_blank">C币兑换<img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/new.gif" style="display: none; margin-top: -26px; width: 23px;"></a></dd>                    </dl>                  </div>                  <div class="detail last">                    <dl>                      <dt>                        <h5>俱乐部</h5>                      </dt>                      <dd> <a href="http://cto.csdn.net/?ref=toolbar" target="_blank">CTO俱乐部</a></dd>                      <dd> <a href="http://student.csdn.net/?ref=toolbar" target="_blank">高校俱乐部</a></dd>                    </dl>                  </div>                </div>              </div>            </li>            </ul>          </div>        </div>    </div>
     <!--new top-->
    <div id="container">
        <div id="header">
    <div class="header">
        <div id="blog_title">
            <h2>
                <a href="http://blog.csdn.net/qinjuning">qinjuning、lets go</a></h2>
            <h3>编程珠玑 JVM  Android爱好者QQ群：55945620 </h3>
            <div class="clear">
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
</div>
<div id="navigator">
    <div class="navigator_bg">
    </div>
    <div class="navigator">
        <ul>
            
                <li id="btnContents"><a href="http://blog.csdn.net/qinjuning?viewmode=contents"><span onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_mulu&#39;])">
                    <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ico_list.gif">目录视图</span></a></li>
                <li id="btnView"><a href="http://blog.csdn.net/qinjuning?viewmode=list"><span onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_zhaiyao&#39;])">
                    <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ico_summary.gif">摘要视图</span></a></li>
                <li id="btnRss"><a href="http://blog.csdn.net/qinjuning/rss/list"><span onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_RSS&#39;])">
                    <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ico_rss.gif">订阅</span></a></li>                

            </ul>
    </div>
</div>
<script type="text/javascript">
    var username = "qinjuning";
    var _blogger = username;
    var blog_address = "http://blog.csdn.net/qinjuning";
    var static_host = "http://static.blog.csdn.net";
    var currentUserName = "";  
</script>

        <div id="body">
            <div id="main">
                <div class="main">
                        <div class="ad_class">
<div class="notice tracking-ad" data-mod="popu_3"> 

<a href="http://geek.csdn.net/news/detail/34791" target="_blank"><font color="blue">
新版极客头条上线，每天一大波干货</font></a>
&nbsp;&nbsp;&nbsp;
  

<a href="http://www.csdn.net/article/2015-07-06/2825132-Android" target="_blank">
<font color="red">任玉刚：Android开发者的职场规划  
</font></a>
&nbsp;&nbsp;&nbsp;

<a href="http://edu.csdn.net/training/ios-15-1" target="_blank">
<font color="blue">从零练就iOS高手实战班震撼来袭
</font></a>
&nbsp;&nbsp;&nbsp;

<a href="http://www.csdn.net/article/2015-06-05/2824836-database" target="_blank">
<font color="red">新型数据库利弊谈 
</font></a>


&nbsp;&nbsp;&nbsp;</div>                        </div>
                        

  
<link href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/comment1.css" type="text/css" rel="stylesheet">
<link href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/style1.css" type="text/css" rel="stylesheet">
<script language="JavaScript" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/jquery.cookie.js"></script>
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/main(1).js"></script>


<link rel="stylesheet" href="http://static.blog.csdn.net/public/res-min/markdown_views.css?v=1.0">

<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/MathJax.js"></script>









  <script type="text/ecmascript">
      window.quickReplyflag = true;
    </script>
<div id="article_details" class="details">
    <div class="article_title">   
         <span class="ico ico_type_Original"></span>


    <h1>
        <span class="link_title"><a href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET.html">
        Android中Context详解 ---- 你所不知道的Context            
        </a>
        </span>
    </h1>
</div>

    <div class="article_manage">
        <span class="link_categories">
        分类：
            <a href="http://blog.csdn.net/qinjuning/article/category/1073230" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_fenlei&#39;]);">Andoird框架浅析</a> 
        </span>
    <span class="link_postdate">2012-03-01 21:17</span>
    <span class="link_view" title="阅读次数">123921人阅读</span>
    <span class="link_comments" title="评论次数"><a href="http://blog.csdn.net/qinjuning/article/details/7310620#comments" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_pinglun&#39;])">评论</a>(57)</span>
    <span class="link_collect"><a href="javascript:void(0);" onclick="javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_shoucang&#39;]);collectArticle(&#39;Android中Context详解 ---- 你所不知道的Context&#39;,&#39;7310620&#39;);return false;" title="收藏">收藏</a></span>
    <span class="link_report"><a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" onclick="javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_jubao&#39;]);report(7310620,2);return false;" title="举报">举报</a></span>
    
</div>
<div class="tag2box"><a href="http://www.csdn.net/tag/android" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">android</a><a href="http://www.csdn.net/tag/application" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">application</a><a href="http://www.csdn.net/tag/service" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">service</a><a href="http://www.csdn.net/tag/null" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">null</a><a href="http://www.csdn.net/tag/string" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">string</a><a href="http://www.csdn.net/tag/class" target="_blank" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_tag&#39;]);">class</a></div>

  
    
<div style="clear:both"></div><div style="border:solid 1px #ccc; background:#eee; float:left; min-width:200px;padding:4px 10px;"><p style="text-align:right;margin:0;"><span style="float:left;">目录<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" title="系统根据文章中H1到H6标签自动生成文章目录">(?)</a></span><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" onclick="javascript:return openct(this);" title="展开">[+]</a></p><ol style="display:none;margin-left:14px;padding-left:14px;line-height:160%;"><li><a href="http://blog.csdn.net/qinjuning/article/details/7310620#t0">&nbsp;一Context相关类的继承关系</a></li><li><a href="http://blog.csdn.net/qinjuning/article/details/7310620#t1">二 什么时候创建Context实例&nbsp;</a></li></ol></div><div style="clear:both"></div><div id="article_content" class="article_content">

<p><span style="font-family:Microsoft YaHei; font-size:16px"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 本文原创 ，转载必须注明出处 :</strong></span><a href="http://blog.csdn.net/qinjuning"><span style="font-family:Microsoft YaHei; font-size:16px; color:#000000; background-color:rgb(255,255,255)"><strong>http://blog.csdn.net/qinjuning</strong></span></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;<span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000099">前言：本文是我读《Android内核剖析》第7章&nbsp;后形成的读书笔记 ，在此向欲了解Android框架的书籍推荐此书。</span></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 大家好，&nbsp; 今天给大家介绍下我们在应用开发中最熟悉而陌生的朋友-----Context类 ，说它熟悉，是应为我们在开发中</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 时刻的在与它打交道，例如：Service、BroadcastReceiver、Activity等都会利用到Context的相关方法 ； 说它陌生，完全是</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 因为我们真正的不懂Context的原理、类结构关系。一个简单的问题是，一个应用程序App中存在多少个Context实例对象呢？</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 一个、两个？ 在此先卖个关子吧。读了本文，相信您会豁然开朗的 。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context，中文直译为“上下文”，SDK中对其说明如下：</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="background-color:#ffffff">
<span style="color:#c0c0c0">&nbsp;&nbsp;</span><span style="color:#333333"> </span><span style="color:#000000">Interface to global information about an application environment. This is an abstract class whose implementation</span></span></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000000; background-color:#ffffff">&nbsp; is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000000; background-color:#ffffff">&nbsp; for application-level operations such as launching activities, broadcasting and receiving intents, etc</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"></span><span style="color:#000000">&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;从上可知一下三点,即：</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#000099">&nbsp;&nbsp;&nbsp; 1、它描述的是一个应用程序环境的信息，即上下文。</span></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、该类是一个抽象(abstract class)类，Android提供了该抽象类的具体实现类(后面我们会讲到是ContextIml类)。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3、通过它我们可以获取应用程序的资源和类，也包括一些应用级别操作，例如：启动一个Activity，发送广播，接受Intent</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;信息&nbsp;等。。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 于是，我们可以利用该Context对象去构建应用级别操作(application-level operations) 。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<h3><a name="t0"></a>&nbsp;一、Context相关类的继承关系</h3>
<p>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<img alt="" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/0_1330607569Vj4c.gif"></span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:微软雅黑; font-size:16px">&nbsp; <strong>相关类介绍：</strong></span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;<span style="color:#000099">&nbsp;<strong> Context类</strong></span>&nbsp; &nbsp; 路径： /frameworks/base/core/java/android/content/Context.java</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;说明：&nbsp; 抽象类，提供了一组通用的API。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 源代码(部分)如下：</span><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;</span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 2088px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_1" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_1" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="keyword">public</span><span>&nbsp;</span><span class="keyword">abstract</span><span>&nbsp;</span><span class="keyword">class</span><span>&nbsp;Context&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">abstract</span><span>&nbsp;Object&nbsp;getSystemService(String&nbsp;name);&nbsp;&nbsp;</span><span class="comment">//获得系统级服务</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">abstract</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;startActivity(Intent&nbsp;intent);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//通过一个Intent启动Activity</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">abstract</span><span>&nbsp;ComponentName&nbsp;startService(Intent&nbsp;service);&nbsp;&nbsp;</span><span class="comment">//启动Service</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//根据文件名得到SharedPreferences对象</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">abstract</span><span>&nbsp;SharedPreferences&nbsp;getSharedPreferences(String&nbsp;name,</span><span class="keyword">int</span><span>&nbsp;mode);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">public abstract class Context {
	 ...
 	 public abstract Object getSystemService(String name);  //获得系统级服务
	 public abstract void startActivity(Intent intent);     //通过一个Intent启动Activity
	 public abstract ComponentName startService(Intent service);  //启动Service
	 //根据文件名得到SharedPreferences对象
	 public abstract SharedPreferences getSharedPreferences(String name,int mode);
	 ...
}</pre>
<p><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;<span style="color:#000099"><strong>&nbsp;ContextIml.java类</strong></span>&nbsp; 路径 ：/frameworks/base/core/java/android/app/ContextImpl.java</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 说明：<span style="font-family:Microsoft YaHei; font-size:16px">该Context类的实现类为ContextIml，该类实现了Context类的功能。请注意，该函数的大部分功能都是直接调用</span></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 其属性mPackageInfo去完成，这点我们后面会讲到。</span>&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 源代码(部分)如下：</span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 2463px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_2" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_2" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">/**</span>&nbsp;</span></li><li class=""><span><span class="comment">&nbsp;*&nbsp;Common&nbsp;implementation&nbsp;of&nbsp;Context&nbsp;API,&nbsp;which&nbsp;provides&nbsp;the&nbsp;base</span>&nbsp;</span></li><li class="alt"><span><span class="comment">&nbsp;*&nbsp;context&nbsp;object&nbsp;for&nbsp;Activity&nbsp;and&nbsp;other&nbsp;application&nbsp;components.</span>&nbsp;</span></li><li class=""><span><span class="comment">&nbsp;*/</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span><span class="keyword">class</span><span>&nbsp;ContextImpl&nbsp;</span><span class="keyword">extends</span><span>&nbsp;Context{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//所有Application程序公用一个mPackageInfo对象</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">/*package*/</span><span>&nbsp;ActivityThread.PackageInfo&nbsp;mPackageInfo;&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="annotation">@Override</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;Object&nbsp;getSystemService(String&nbsp;name){&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span><span>&nbsp;</span><span class="keyword">if</span><span>&nbsp;(ACTIVITY_SERVICE.equals(name))&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span><span>&nbsp;getActivityManager();&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span><span>&nbsp;</span><span class="keyword">if</span><span>&nbsp;(INPUT_METHOD_SERVICE.equals(name))&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span><span>&nbsp;InputMethodManager.getInstance(</span><span class="keyword">this</span><span>);&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="annotation">@Override</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;startActivity(Intent&nbsp;intent)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//开始启动一个Activity</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mMainThread.getInstrumentation().execStartActivity(&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getOuterContext(),&nbsp;mMainThread.getApplicationThread(),&nbsp;<span class="keyword">null</span><span>,&nbsp;</span><span class="keyword">null</span><span>,&nbsp;intent,&nbsp;-</span><span class="number">1</span><span>);&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">/**
 * Common implementation of Context API, which provides the base
 * context object for Activity and other application components.
 */
class ContextImpl extends Context{
	//所有Application程序公用一个mPackageInfo对象
    /*package*/ ActivityThread.PackageInfo mPackageInfo;
    
    @Override
    public Object getSystemService(String name){
    	...
    	else if (ACTIVITY_SERVICE.equals(name)) {
            return getActivityManager();
        } 
    	else if (INPUT_METHOD_SERVICE.equals(name)) {
            return InputMethodManager.getInstance(this);
        }
    } 
    @Override
    public void startActivity(Intent intent) {
    	...
    	//开始启动一个Activity
        mMainThread.getInstrumentation().execStartActivity(
            getOuterContext(), mMainThread.getApplicationThread(), null, null, intent, -1);
    }
}</pre>
<p>&nbsp;</p>
<p><br>
&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099"><strong>&nbsp;&nbsp;</strong></span><span style="font-family:Microsoft YaHei; font-size:16px"><span style="color:#000099"><strong>ContextWrapper类</strong></span> 路径 ：\frameworks\base\core\java\android\content\ContextWrapper.java</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;说明： 正如其名称一样，该类只是对Context类的一种包装，该类的构造函数包含了一个真正的Context引用，即ContextIml</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对象。&nbsp;&nbsp;&nbsp; 源代码(部分)如下：</span><span style="font-family:Microsoft YaHei; font-size:16px"></span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 3174px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_3" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_3" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="keyword">public</span><span>&nbsp;</span><span class="keyword">class</span><span>&nbsp;ContextWrapper&nbsp;</span><span class="keyword">extends</span><span>&nbsp;Context&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;Context&nbsp;mBase;&nbsp;&nbsp;<span class="comment">//该属性指向一个ContextIml实例，一般在创建Application、Service、Activity时赋值</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//创建Application、Service、Activity，会调用该方法给mBase属性赋值</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;attachBaseContext(Context&nbsp;base)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(mBase&nbsp;!=&nbsp;</span><span class="keyword">null</span><span>)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">throw</span><span>&nbsp;</span><span class="keyword">new</span><span>&nbsp;IllegalStateException(</span><span class="string">"Base&nbsp;context&nbsp;already&nbsp;set"</span><span>);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mBase&nbsp;=&nbsp;base;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="annotation">@Override</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;startActivity(Intent&nbsp;intent)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mBase.startActivity(intent);&nbsp;&nbsp;<span class="comment">//调用mBase实例方法</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">public class ContextWrapper extends Context {
    Context mBase;  //该属性指向一个ContextIml实例，一般在创建Application、Service、Activity时赋值
    
    //创建Application、Service、Activity，会调用该方法给mBase属性赋值
    protected void attachBaseContext(Context base) {
        if (mBase != null) {
            throw new IllegalStateException("Base context already set");
        }
        mBase = base;
    }
    @Override
    public void startActivity(Intent intent) {
        mBase.startActivity(intent);  //调用mBase实例方法
    }
}</pre>
<p>&nbsp;</p>
<p><br>
&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; <span style="color:#000099">
<strong>ContextThemeWrapper类</strong></span> 路径：/frameworks/base/core/java/android/view/ContextThemeWrapper.java</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;说明：该类内部包含了主题(Theme)相关的接口，即android:theme属性指定的。</span><span style="font-family:Microsoft YaHei; font-size:16px">只有Activity需要主题，Service不需要主题，</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 所以Service直接继承于ContextWrapper类。</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 源代码(部分)如下：</span><span style="font-family:Microsoft YaHei; font-size:16px"></span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 3706px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_4" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_4" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="keyword">public</span><span>&nbsp;</span><span class="keyword">class</span><span>&nbsp;ContextThemeWrapper&nbsp;</span><span class="keyword">extends</span><span>&nbsp;ContextWrapper&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//该属性指向一个ContextIml实例，一般在创建Application、Service、Activity时赋值</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">private</span><span>&nbsp;Context&nbsp;mBase;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//mBase赋值方式同样有一下两种</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;ContextThemeWrapper(Context&nbsp;base,&nbsp;</span><span class="keyword">int</span><span>&nbsp;themeres)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span><span>(base);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mBase&nbsp;=&nbsp;base;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mThemeResource&nbsp;=&nbsp;themeres;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="annotation">@Override</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">protected</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;attachBaseContext(Context&nbsp;newBase)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">super</span><span>.attachBaseContext(newBase);&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mBase&nbsp;=&nbsp;newBase;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">public class ContextThemeWrapper extends ContextWrapper {
	 //该属性指向一个ContextIml实例，一般在创建Application、Service、Activity时赋值
	 
	 private Context mBase;
	//mBase赋值方式同样有一下两种
	 public ContextThemeWrapper(Context base, int themeres) {
	        super(base);
	        mBase = base;
	        mThemeResource = themeres;
	 }

	 @Override
	 protected void attachBaseContext(Context newBase) {
	        super.attachBaseContext(newBase);
	        mBase = newBase;
	 }
}
</pre>
<p><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp; Activity类 、Service类 、Application类本质上都是Context子类， 更多信息大家可以自行参考源代码进行理解。</span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<p>&nbsp;</p>
<h3><a name="t1"></a>二、 什么时候创建Context实例&nbsp;</h3>
<p>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;熟悉了Context的继承关系后，我们接下来分析应用程序在什么情况需要创建Context对象的？</span><span style="font-family:Microsoft YaHei; font-size:16px">应用程序创建Context实例的</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;情况有如下几种情况：</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px"><span style="color:#000099">&nbsp;&nbsp;&nbsp;&nbsp;<strong>&nbsp; 1、创建Application 对象时， 而且整个App共一个Application对象</strong></span></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2、创建Service对象时</strong></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3、创建Activity对象时</strong></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp; 因此应用程序App共有的Context数目公式为：</span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px; color:#cc0000"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 总Context实例个数 = Service个数 + Activity个数 + 1（Application对应的Context实例）</strong></span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;<strong> 具体创建Context的时机</strong></span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;<span style="color:#000099">&nbsp; 1、创建Application对象的时机</span></span></p>
<p><span style="font-family:微软雅黑; font-size:16px; color:#000099"></span>&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;每个应用程序在第一次启动时，都会首先创建Application对象。如果对应用程序启动一个Activity(startActivity)流程比较</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">清楚的话，创建Application的时机在创建handleBindApplication()方法中，该函数位于 ActivityThread.java类中 ，如下：</span><span style="font-family:Microsoft YaHei; font-size:16px"></span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 4763px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_5" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_5" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">//创建Application时同时创建的ContextIml实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;handleBindApplication(AppBindData&nbsp;data){&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">///创建Application对象</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;app&nbsp;=&nbsp;data.info.makeApplication(data.restrictedBackupMode,&nbsp;<span class="keyword">null</span><span>);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span><span class="keyword">public</span><span>&nbsp;Application&nbsp;makeApplication(</span><span class="keyword">boolean</span><span>&nbsp;forceDefaultAppClass,&nbsp;Instrumentation&nbsp;instrumentation)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">try</span><span>&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;java.lang.ClassLoader&nbsp;cl&nbsp;=&nbsp;getClassLoader();&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContextImpl&nbsp;appContext&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;ContextImpl();&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//创建一个ContextImpl对象实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appContext.init(<span class="keyword">this</span><span>,&nbsp;</span><span class="keyword">null</span><span>,&nbsp;mActivityThread);&nbsp;&nbsp;</span><span class="comment">//初始化该ContextIml实例的相关属性</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">///新建一个Application对象&nbsp;</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;app&nbsp;=&nbsp;mActivityThread.mInstrumentation.newApplication(&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cl,&nbsp;appClass,&nbsp;appContext);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appContext.setOuterContext(app);&nbsp;&nbsp;<span class="comment">//将该Application实例传递给该ContextImpl实例&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">//创建Application时同时创建的ContextIml实例
private final void handleBindApplication(AppBindData data){
    ...
	///创建Application对象
    Application app = data.info.makeApplication(data.restrictedBackupMode, null);
    ...
}

public Application makeApplication(boolean forceDefaultAppClass, Instrumentation instrumentation) {
	...
	try {
        java.lang.ClassLoader cl = getClassLoader();
        ContextImpl appContext = new ContextImpl();    //创建一个ContextImpl对象实例
        appContext.init(this, null, mActivityThread);  //初始化该ContextIml实例的相关属性
        ///新建一个Application对象 
        app = mActivityThread.mInstrumentation.newApplication(
                cl, appClass, appContext);
       appContext.setOuterContext(app);  //将该Application实例传递给该ContextImpl实例         
    } 
	...
}</pre>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px; color:#000099">&nbsp;&nbsp;&nbsp; 2、创建Activity对象的时机</span></p>
<p align="left"><span style="font-family:微软雅黑; font-size:16px; color:#000099"></span>&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 通过startActivity()或startActivityForResult()请求启动一个Activity时，如果系统检测需要新建一个Activity对象时，就会</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;回调handleLaunchActivity()方法，该方法继而调用performLaunchActivity()方法，去创建一个Activity实例，并且回调</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;onCreate()，onStart()方法等， 函数都位于 ActivityThread.java类 ，如下：</span><span style="font-family:Microsoft YaHei; font-size:16px"></span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 5436px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_6" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_6" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=6&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">//创建一个Activity实例时同时创建ContextIml实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;handleLaunchActivity(ActivityRecord&nbsp;r,&nbsp;Intent&nbsp;customIntent)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;Activity&nbsp;a&nbsp;=&nbsp;performLaunchActivity(r,&nbsp;customIntent);&nbsp;&nbsp;<span class="comment">//启动一个Activity</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li><li class=""><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;Activity&nbsp;performLaunchActivity(ActivityRecord&nbsp;r,&nbsp;Intent&nbsp;customIntent)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;Activity&nbsp;activity&nbsp;=&nbsp;<span class="keyword">null</span><span>;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">try</span><span>&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//创建一个Activity对象实例</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;java.lang.ClassLoader&nbsp;cl&nbsp;=&nbsp;r.packageInfo.getClassLoader();&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;activity&nbsp;=&nbsp;mInstrumentation.newActivity(cl,&nbsp;component.getClassName(),&nbsp;r.intent);&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(activity&nbsp;!=&nbsp;</span><span class="keyword">null</span><span>)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ContextImpl&nbsp;appContext&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;ContextImpl();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//创建一个Activity实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appContext.init(r.packageInfo,&nbsp;r.token,&nbsp;<span class="keyword">this</span><span>);&nbsp;&nbsp;&nbsp;</span><span class="comment">//初始化该ContextIml实例的相关属性</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appContext.setOuterContext(activity);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//将该Activity信息传递给该ContextImpl实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">//创建一个Activity实例时同时创建ContextIml实例
private final void handleLaunchActivity(ActivityRecord r, Intent customIntent) {
	...
	Activity a = performLaunchActivity(r, customIntent);  //启动一个Activity
}
private final Activity performLaunchActivity(ActivityRecord r, Intent customIntent) {
	...
	Activity activity = null;
    try {
    	//创建一个Activity对象实例
        java.lang.ClassLoader cl = r.packageInfo.getClassLoader();
        activity = mInstrumentation.newActivity(cl, component.getClassName(), r.intent);
    }
    if (activity != null) {
        ContextImpl appContext = new ContextImpl();      //创建一个Activity实例
        appContext.init(r.packageInfo, r.token, this);   //初始化该ContextIml实例的相关属性
        appContext.setOuterContext(activity);            //将该Activity信息传递给该ContextImpl实例
        ...
    }
    ...    
}</pre>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; </span>
<span style="font-family:Microsoft YaHei; font-size:16px; color:#000099">3、创建Service对象的时机</span></p>
<p align="left"><span style="font-family:微软雅黑; font-size:16px; color:#000099"></span>&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;通过startService或者bindService时，如果系统检测到需要新创建一个Service实例，就会回调handleCreateService()方法，</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;完成相关数据操作。</span><span style="font-family:Microsoft YaHei; font-size:16px">handleCreateService()函数位于 ActivityThread.java类，如下：</span><span style="font-family:Microsoft YaHei; font-size:16px"></span></p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 6067px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_7" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_7" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=7&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">//创建一个Service实例时同时创建ContextIml实例</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;</span><span class="keyword">void</span><span>&nbsp;handleCreateService(CreateServiceData&nbsp;data){&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//创建一个Service实例</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;Service&nbsp;service&nbsp;=&nbsp;<span class="keyword">null</span><span>;&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">try</span><span>&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;java.lang.ClassLoader&nbsp;cl&nbsp;=&nbsp;packageInfo.getClassLoader();&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;service&nbsp;=&nbsp;(Service)&nbsp;cl.loadClass(data.info.name).newInstance();&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword">catch</span><span>&nbsp;(Exception&nbsp;e)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;ContextImpl&nbsp;context&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;ContextImpl();&nbsp;</span><span class="comment">//创建一个ContextImpl对象实例</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;context.init(packageInfo,&nbsp;<span class="keyword">null</span><span>,&nbsp;</span><span class="keyword">this</span><span>);&nbsp;&nbsp;&nbsp;</span><span class="comment">//初始化该ContextIml实例的相关属性</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//获得我们之前创建的Application对象信息</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;Application&nbsp;app&nbsp;=&nbsp;packageInfo.makeApplication(<span class="keyword">false</span><span>,&nbsp;mInstrumentation);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//将该Service信息传递给该ContextImpl实例</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;context.setOuterContext(service);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class="alt"><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">//创建一个Service实例时同时创建ContextIml实例
private final void handleCreateService(CreateServiceData data){
	...
	//创建一个Service实例
	Service service = null;
    try {
        java.lang.ClassLoader cl = packageInfo.getClassLoader();
        service = (Service) cl.loadClass(data.info.name).newInstance();
    } catch (Exception e) {
    }
	...
	ContextImpl context = new ContextImpl(); //创建一个ContextImpl对象实例
    context.init(packageInfo, null, this);   //初始化该ContextIml实例的相关属性
    //获得我们之前创建的Application对象信息
    Application app = packageInfo.makeApplication(false, mInstrumentation);
    //将该Service信息传递给该ContextImpl实例
    context.setOuterContext(service);
    ...
}
</pre>
<p align="left"><br>
</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp; </span>
<span style="font-family:Microsoft YaHei; font-size:16px">另外，需要强调一点的是，通过对ContextImp的分析可知，其方法的大多数操作都是直接调用其属性mPackageInfo(该属性类</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">型为PackageInfo)的相关方法而来。这说明<span style="color:#cc0000"><strong>ContextImp是一种轻量级类，而PackageInfo才是真正重量级的类</strong></span>。而一个App里的</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">所</span><span style="font-family:Microsoft YaHei; font-size:16px">有ContextIml实例，都对应同一个packageInfo对象。</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp; &nbsp;&nbsp; 最后给大家分析利用Context获取SharedPreferences类的使用方法，SharedPreferences类想必大家都使用过，其一般获取方</span></p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">法就是通过</span><span style="font-family:Microsoft YaHei; font-size:16px">调用getSharedPreferences()方法去根据相关信息获取SharedPreferences对象。具体流程</span><span style="font-family:Microsoft YaHei; font-size:16px">如下：</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp; 1 、调用&nbsp; getSharedPreferences()获取对应的的文件，该函数实现功能如下：</span></p>
<p align="left"><span style="font-family:微软雅黑; font-size:16px"></span><span style="font-family:Microsoft YaHei; font-size:16px"></span>&nbsp;</p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 6851px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_8" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_8" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=8&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">//Context类静态数据集合，以键值对保存了所有读取该xml文件后所形成的数据集合</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">static</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;HashMap&lt;File,&nbsp;SharedPreferencesImpl&gt;&nbsp;sSharedPrefs&nbsp;=&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">new</span><span>&nbsp;HashMap&lt;File,&nbsp;SharedPreferencesImpl&gt;();&nbsp;&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;</span></li><li class="alt"><span><span class="annotation">@Override</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="keyword">public</span><span>&nbsp;SharedPreferences&nbsp;getSharedPreferences(String&nbsp;name,&nbsp;</span><span class="keyword">int</span><span>&nbsp;mode){&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//其所对应的SharedPreferencesImpl对象&nbsp;，该对象已一个HashMap集合保存了我们对该文件序列化结果</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SharedPreferencesImpl&nbsp;sp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;f&nbsp;=&nbsp;getSharedPrefsFile(name);&nbsp;&nbsp;<span class="comment">//该包下是否存在对应的文件，不存在就新建一个</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">synchronized</span><span>&nbsp;(sSharedPrefs)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//是否已经读取过该文件，是就直接返回该SharedPreferences对象</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp&nbsp;=&nbsp;sSharedPrefs.get(f);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(sp&nbsp;!=&nbsp;</span><span class="keyword">null</span><span>&nbsp;&amp;&amp;&nbsp;!sp.hasFileChanged())&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//Log.i(TAG,&nbsp;"Returning&nbsp;existing&nbsp;prefs&nbsp;"&nbsp;+&nbsp;name&nbsp;+&nbsp;":&nbsp;"&nbsp;+&nbsp;sp);</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span><span>&nbsp;sp;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//以下为序列化该xml文件，同时将数据写到map集合中&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&nbsp;map&nbsp;=&nbsp;<span class="keyword">null</span><span>;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(f.exists()&nbsp;&amp;&amp;&nbsp;f.canRead())&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">try</span><span>&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;FileInputStream(f);&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map&nbsp;=&nbsp;XmlUtils.readMapXml(str);&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str.close();&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">synchronized</span><span>&nbsp;(sSharedPrefs)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(sp&nbsp;!=&nbsp;</span><span class="keyword">null</span><span>)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//Log.i(TAG,&nbsp;"Updating&nbsp;existing&nbsp;prefs&nbsp;"&nbsp;+&nbsp;name&nbsp;+&nbsp;"&nbsp;"&nbsp;+&nbsp;sp&nbsp;+&nbsp;":&nbsp;"&nbsp;+&nbsp;map);</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp.replace(map);&nbsp;&nbsp;&nbsp;<span class="comment">//更新数据集合</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span class="keyword">else</span><span>&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp&nbsp;=&nbsp;sSharedPrefs.get(f);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">if</span><span>&nbsp;(sp&nbsp;==&nbsp;</span><span class="keyword">null</span><span>)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//新建一个SharedPreferencesImpl对象，并且设置其相关属性</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sp&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;SharedPreferencesImpl(f,&nbsp;mode,&nbsp;map);&nbsp;&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sSharedPrefs.put(f,&nbsp;sp);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span><span>&nbsp;sp;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">//Context类静态数据集合，以键值对保存了所有读取该xml文件后所形成的数据集合
private static final HashMap&lt;File, SharedPreferencesImpl&gt; sSharedPrefs = 
	   new HashMap&lt;File, SharedPreferencesImpl&gt;(); 

@Override
public SharedPreferences getSharedPreferences(String name, int mode){
	 //其所对应的SharedPreferencesImpl对象 ，该对象已一个HashMap集合保存了我们对该文件序列化结果
	 SharedPreferencesImpl sp;  
     File f = getSharedPrefsFile(name);  //该包下是否存在对应的文件，不存在就新建一个
     synchronized (sSharedPrefs) {       //是否已经读取过该文件，是就直接返回该SharedPreferences对象
         sp = sSharedPrefs.get(f);
         if (sp != null &amp;&amp; !sp.hasFileChanged()) {
             //Log.i(TAG, "Returning existing prefs " + name + ": " + sp);
             return sp;
         }
     }
     //以下为序列化该xml文件，同时将数据写到map集合中     
     Map map = null;
     if (f.exists() &amp;&amp; f.canRead()) {
         try {
             str = new FileInputStream(f);
             map = XmlUtils.readMapXml(str);
             str.close();
         } 
         ...
     }
     
     synchronized (sSharedPrefs) {
         if (sp != null) {
             //Log.i(TAG, "Updating existing prefs " + name + " " + sp + ": " + map);
             sp.replace(map);   //更新数据集合
         } else {
             sp = sSharedPrefs.get(f);
             if (sp == null) {  
            	 //新建一个SharedPreferencesImpl对象，并且设置其相关属性
                 sp = new SharedPreferencesImpl(f, mode, map);  
                 sSharedPrefs.put(f, sp);
             }
         }
         return sp;
     }
}
</pre>
<p>&nbsp;</p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp; 2、 SharedPreferences 不过是个接口，它定义了一些操作xml文件的方法，其真正实现类为SharedPreferencesImpl ，该类是</span></p>
<p><span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp; ContextIml的内部类，该类如下：</span></p>
<p><span style="font-family:微软雅黑; font-size:16px"></span>&nbsp;</p>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command(&#39;ViewSource&#39;,this);return false;">view plain</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command(&#39;CopyToClipboard&#39;,this);return false;">copy</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command(&#39;PrintSource&#39;,this);return false;">print</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="About" title="?" onclick="dp.sh.Toolbar.Command(&#39;About&#39;,this);return false;">?</a><div style="position: absolute; left: 398px; top: 7802px; width: 22px; height: 10px; z-index: 99;"><embed id="ZeroClipboardMovie_9" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="22" height="10" name="ZeroClipboardMovie_9" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=9&amp;width=22&amp;height=10" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="comment">//soga，这种形式我们在分析Context&nbsp;ContextIml时接触过&nbsp;</span><span>&nbsp;&nbsp;</span></span></li><li class=""><span><span class="comment">//SharedPreferences只是一种接口，其真正实现类是SharedPreferencesImpl类</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span><span class="keyword">private</span><span>&nbsp;</span><span class="keyword">static</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;</span><span class="keyword">class</span><span>&nbsp;SharedPreferencesImpl&nbsp;</span><span class="keyword">implements</span><span>&nbsp;SharedPreferences{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">private</span><span>&nbsp;Map&nbsp;mMap;&nbsp;&nbsp;</span><span class="comment">//保存了该文件序列化结果后的操作，&nbsp;键值对形式</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//通过key值获取对应的value值</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;String&nbsp;getString(String&nbsp;key,&nbsp;String&nbsp;defValue)&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">synchronized</span><span>&nbsp;(</span><span class="keyword">this</span><span>)&nbsp;{&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;v&nbsp;=&nbsp;(String)mMap.get(key);&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">return</span><span>&nbsp;v&nbsp;!=&nbsp;</span><span class="keyword">null</span><span>&nbsp;?&nbsp;v&nbsp;:&nbsp;defValue;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">//获得该SharedPreferencesImpl对象对应的Edito类，对数据进行操作</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">public</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;</span><span class="keyword">class</span><span>&nbsp;EditorImpl&nbsp;</span><span class="keyword">implements</span><span>&nbsp;Editor&nbsp;{&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">private</span><span>&nbsp;</span><span class="keyword">final</span><span>&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;mModified&nbsp;=&nbsp;Maps.newHashMap();&nbsp;</span><span class="comment">//保存了对键值变化的集合</span><span>&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class=""><span>}&nbsp;&nbsp;</span></li></ol></div><pre class="java" name="code" style="display: none;">//soga，这种形式我们在分析Context ContextIml时接触过 
//SharedPreferences只是一种接口，其真正实现类是SharedPreferencesImpl类
private static final class SharedPreferencesImpl implements SharedPreferences{
	 private Map mMap;  //保存了该文件序列化结果后的操作， 键值对形式
	 
	 //通过key值获取对应的value值
	 public String getString(String key, String defValue) {
         synchronized (this) {
             String v = (String)mMap.get(key);
             return v != null ? v : defValue;
         }
     }
	 ...
	 //获得该SharedPreferencesImpl对象对应的Edito类，对数据进行操作
	 public final class EditorImpl implements Editor {
		 private final Map&lt;String, Object&gt; mModified = Maps.newHashMap(); //保存了对键值变化的集合
	 }
}
</pre>
<p>&nbsp;</p>
<p><br>
<br>
<span style="font-family:Microsoft YaHei; font-size:16px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 基本上获取SharedPreferences 对象就是这么来的，关于Context里的更多方法请大家参照源代码认真学习吧。</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
    
        <div style="padding-top:20px">         
            <p style="font-size:12px;">版权声明：本文为博主原创文章，未经博主允许不得转载。</p>
        </div>
</div>




<!-- Baidu Button BEGIN -->

<div class="bdsharebuttonbox bdshare-button-style0-16" style="float: right;" data-bd-bind="1436864192068">
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important"></a>
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间" style="background-position:0 -52px !important"></a>
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博" style="background-position:0 -104px !important"></a>
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博" style="background-position:0 -260px !important"></a>
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_renren" data-cmd="renren" title="分享到人人网" style="background-position:0 -208px !important"></a>
<a href="http://blog.csdn.net/qinjuning/article/details/7310620#" class="bds_weixin" data-cmd="weixin" title="分享到微信" style="background-position:0 -1612px !important"></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->

            <link rel="stylesheet" href="http://static.blog.csdn.net/css/blog_detail.css">

    
<!--172.16.140.11-->
<ul class="article_next_prev">
            <li class="prev_article"><span onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_shangyipian&#39;]);location.href=&#39;/qinjuning/article/details/7277225&#39;;">上一篇</span><a href="http://blog.csdn.net/qinjuning/article/details/7277225" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_shangyipian&#39;])">Android中启动Activity(startActivity)流程图分析</a></li>
            <li class="next_article"><span onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_xiayipian&#39;]);location.href=&#39;/qinjuning/article/details/7318211&#39;;">下一篇</span><a href="http://blog.csdn.net/qinjuning/article/details/7318211" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_xiayipian&#39;])">Linux学习笔记一 ---- Linux基础知识认知以及初识Linux下C编程入门</a></li>
</ul>

<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=1536434" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/bds_s_v2.js"></script>

<script type="text/javascript">
    document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000)
</script>
<!-- Baidu Button END -->

 

        <div id="digg" articleid="7310620">
            <dl id="btnDigg" class="digg digg_disable">
                <dt onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_ding&#39;])">顶</dt>
                <dd>104</dd>
            </dl>
            <dl id="btnBury" class="digg digg_disable">
                <dt onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_cai&#39;])">踩</dt>
                <dd>5</dd>
            </dl>
        </div>
</div>
  

    <dl class="blog-associat-tag">
        <dt>主题推荐</dt>
        <dd>
                <a href="http://www.csdn.net/tag/android" target="_blank" class="blog-tage-red">android</a> 
                <a href="http://www.csdn.net/tag/microsoft" target="_blank" class="blog-tage-red">microsoft</a> 
        </dd>
    </dl> 

<style>
.blog-ass-articl dd {
color: #369;
width: 99%; /*修改行*/
float: left;
overflow: hidden;
font: normal normal 12px/23px "SimSun";
height: 23px;
margin: 0;
padding: 0 0 0 10px;
margin-right: 30px;
background: url(../images/blog-dot-red3.gif) no-repeat 0 10px;
}

</style>

<dl class="blog-ass-articl" id="res-relatived"> 
     <dt><span>猜你在找</span></dt>    


   


    <div id="adCollege" style="width: 42%;float: left;"> 
        <script src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/job_reco.js" type="text/javascript"></script> 
        <script type="text/javascript">
            csdn.position.showEdu({
                sourceType: "blog",
                searchType: "detail",
                searchKey: "7310620",
                username: "",
                recordcount: "5",
                containerId: "adCollege" //容器DIV的id。 
            });
        </script> 
    <div class="tracking-ad" data-mod="popu_84"><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/456" title="C语言及程序设计提高" strategy="content" target="_blank">C语言及程序设计提高</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/330" title="iOS8开发技术（Swift版）：iOS基础知识" strategy="content" target="_blank">iOS8开发技术（Swift版）：iOS基础知识</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/405" title="反编译Android应用" strategy="content" target="_blank">反编译Android应用</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/395" title="零基础学Java系列从入门到精通" strategy="content" target="_blank">零基础学Java系列从入门到精通</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px; white-space: nowrap;"><a href="http://edu.csdn.net/course/detail/207" title="韦东山嵌入式Linux第一期视频" strategy="hot" target="_blank">韦东山嵌入式Linux第一期视频</a></dd></div></div>  

    
     <div id="res" data-mod="popu_36" class="tracking-ad" style="width: 42%; float: left; margin-right: 30px; display: block;"><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/rosenluo/article/details/40891245" title="分享45个android实例源码很好很强大收藏吧" strategy="CFRecommendAlgorithm" target="_blank">分享45个android实例源码很好很强大收藏吧</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/aeolus1019/article/details/7974430" title="Cannot make a static reference to the non-static method的解决方法" strategy="CFRecommendAlgorithm" target="_blank">Cannot make a static reference to the non-static method的解决方法</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/jdsjlzx/article/details/7553987" title="Android提高篇之自定义dialog实现processDialog正在加载效果使用Animation实现图片旋转" strategy="CFRecommendAlgorithm" target="_blank">Android提高篇之自定义dialog实现processDialog正在加载效果使用Animation实现图片旋转</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/jaysong2012/article/details/45533623" title="Android 特效View第四弹之折线图 心率图" strategy="CFRecommendAlgorithm" target="_blank">Android 特效View第四弹之折线图 心率图</a></dd><dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="http://blog.csdn.net/yangyu20121224/article/details/9122517" title="Android UI设计与开发第15期顶部标题栏六实现悬浮式顶部和底部标题栏效果" strategy="CFRecommendAlgorithm" target="_blank">Android UI设计与开发第15期顶部标题栏六实现悬浮式顶部和底部标题栏效果</a></dd></div>
   
</dl>

<div id="job_blog_reco"><dl class="blog-ass-articl tracking-ad" data-mod="popu_72"><dt><span>准备好了么？&nbsp;<label class="po_blg_detail_tiao">跳</label><label class="po_blg_detail_ba">吧</label><label class="po_blg_detail_th">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;！</label></span><a href="http://job.csdn.net/" target="_blank" class="po_blg_more">更多职位尽在&nbsp;<label class="po_blg_detail_csdn">CSDN JOB</label></a></dt><dd class="po_blg_dd"><div class="po_blg_po"><a href="http://job.csdn.net/Job/Index?jobID=141248" title="Android高级开发工程师" strategy="DetailRecommend" target="_blank">Android高级开发工程师</a></div><div class="po_blg_company"><a href="http://pr.csdn.net/enterprise/ent_home?orgid=445830" title="北京光慧数码科技有限公司" target="_blank">北京光慧数码科技有限公司</a></div><label class="po_blg_separator">|</label><div class="po_blg_salary"><a href="http://job.csdn.net/Job/Index?jobID=141248" target="_blank">15-20K/月</a></div><a class="po_blg_iwant" href="http://job.csdn.net/Job/Index?jobID=141248" target="_blank">我要跳槽</a></dd><dd class="po_blg_dd"><div class="po_blg_po"><a href="http://job.csdn.net/Job/Index?jobID=89164" title="Android开发工程师" strategy="DetailRecommend" target="_blank">Android开发工程师</a></div><div class="po_blg_company"><a href="http://pr.csdn.net/enterprise/ent_home?orgid=370095" title="北京博睿宏远科技发展有限公司" target="_blank">北京博睿宏远科技发展有限公司</a></div><label class="po_blg_separator">|</label><div class="po_blg_salary"><a href="http://job.csdn.net/Job/Index?jobID=89164" target="_blank">8-15K/月</a></div><a class="po_blg_iwant" href="http://job.csdn.net/Job/Index?jobID=89164" target="_blank">我要跳槽</a></dd><dd class="po_blg_dd"><div class="po_blg_po"><a href="http://job.csdn.net/Job/Index?jobID=87045" title="Android开发人员" strategy="DetailRecommend" target="_blank">Android开发人员</a></div><div class="po_blg_company"><a href="http://pr.csdn.net/enterprise/ent_home?orgid=436408" title="福州七二零信息科技有限公司" target="_blank">福州七二零信息科技有限公司</a></div><label class="po_blg_separator">|</label><div class="po_blg_salary"><a href="http://job.csdn.net/Job/Index?jobID=87045" target="_blank">4-8K/月</a></div><a class="po_blg_iwant" href="http://job.csdn.net/Job/Index?jobID=87045" target="_blank">我要跳槽</a></dd><dd class="po_blg_dd"><div class="po_blg_po"><a href="http://job.csdn.net/Job/Index?jobID=141150" title="Android开发工程师" strategy="DetailRecommend" target="_blank">Android开发工程师</a></div><div class="po_blg_company"><a href="http://pr.csdn.net/enterprise/ent_home?orgid=492041" title="唐山" target="_blank">唐山</a></div><label class="po_blg_separator">|</label><div class="po_blg_salary"><a href="http://job.csdn.net/Job/Index?jobID=141150" target="_blank">5-8K/月</a></div><a class="po_blg_iwant" href="http://job.csdn.net/Job/Index?jobID=141150" target="_blank">我要跳槽</a></dd></dl></div>

<script type="text/javascript">
    var searchtitletags = 'Android中Context详解 ---- 你所不知道的Context' + ',' + 'android,microsoft';
    searchService({
        index: 'blog',
        query: searchtitletags,
        from: 5,
        size: 5,
        appendTo: '#res',
        url: 'recommend',
        his: 2,
        client: "blog_cf_enhance",
        tmpl: '<dd style="background:url(http://static.blog.csdn.net/skin/default/images/blog-dot-red3.gif) no-repeat 0 10px;"><a href="#{ url }" title="#{ title }" strategy="#{ strategy }">#{ title }</a></dd>'
    });

 </script>   



    <div id="ad_cen">
   
          <script type="text/javascript">
              new Ad(4, 'ad_cen');
          </script>
    <iframe id="ad_frm_0" frameborder="0" scrolling="no" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ad.html" style="border-width: 0px; overflow: hidden; width: 794px; height: 90px;"></iframe></div>
<div class="comment_class">
    <div id="comment_title" class="panel_head">
        <span class="see_comment">查看评论</span><a name="comments"></a></div>
    <div id="comment_list"><dl class="comment_item comment_topic" id="comment_item_5190935"><dt class="comment_head" floor="42">42楼 <span class="user"><a class="username" href="http://blog.csdn.net/taozuiqizhong" target="_blank">taozuiqizhong</a> <span class="ptime">6天前 10:02发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="5190935" username="taozuiqizhong"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/taozuiqizhong" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_taozuiqizhong.jpg" width="40" height="40"></a></dd><dd class="comment_body">好厉害</dd></dl><dl class="comment_item comment_topic" id="comment_item_5072673"><dt class="comment_head" floor="41">41楼 <span class="user"><a class="username" href="http://blog.csdn.net/b711183612" target="_blank">b711183612</a> <span class="ptime">2015-05-24 20:00发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="5072673" username="b711183612"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/b711183612" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_b711183612.jpg" width="40" height="40"></a></dd><dd class="comment_body">厉害</dd></dl><dl class="comment_item comment_topic" id="comment_item_4915999"><dt class="comment_head" floor="40">40楼 <span class="user"><a class="username" href="http://blog.csdn.net/wha000tIF" target="_blank">wha000tIF</a> <span class="ptime">2015-04-05 14:05发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4915999" username="wha000tIF"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/wha000tIF" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_wha000tif.jpg" width="40" height="40"></a></dd><dd class="comment_body">好文,mark,博主说看源码是官方api吗?</dd></dl><dl class="comment_item comment_topic" id="comment_item_4877911"><dt class="comment_head" floor="39">39楼 <span class="user"><a class="username" href="http://blog.csdn.net/wlccomeon" target="_blank">wlccomeon</a> <span class="ptime">2015-03-26 10:34发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="4877911" username="wlccomeon"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/wlccomeon" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_wlccomeon.jpg" width="40" height="40"></a></dd><dd class="comment_body">解决了困扰多时的疑惑~~~</dd></dl><dl class="comment_item comment_topic" id="comment_item_4873525"><dt class="comment_head" floor="38">38楼 <span class="user"><a class="username" href="http://blog.csdn.net/lev_yang" target="_blank">lev_yang</a> <span class="ptime">2015-03-24 19:49发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4873525" username="lev_yang"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/lev_yang" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_lev_yang.jpg" width="40" height="40"></a></dd><dd class="comment_body">受教了</dd></dl><dl class="comment_item comment_topic" id="comment_item_4831887"><dt class="comment_head" floor="37">37楼 <span class="user"><a class="username" href="http://blog.csdn.net/u010785685" target="_blank">赵亚盟</a> <span class="ptime">2015-03-08 11:00发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4831887" username="u010785685"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u010785685" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u010785685.jpg" width="40" height="40"></a></dd><dd class="comment_body">学习了。写的很棒</dd></dl><dl class="comment_item comment_topic" id="comment_item_4706811"><dt class="comment_head" floor="36">36楼 <span class="user"><a class="username" href="http://blog.csdn.net/genggeng001" target="_blank">不二庚庚</a> <span class="ptime">2015-01-13 15:40发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4706811" username="genggeng001"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/genggeng001" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_genggeng001.jpg" width="40" height="40"></a></dd><dd class="comment_body">多谢博文！！！！！！！！！！</dd></dl><dl class="comment_item comment_topic" id="comment_item_4369629"><dt class="comment_head" floor="35">35楼 <span class="user"><a class="username" href="http://blog.csdn.net/bornjasoncen" target="_blank">bornjasoncen</a> <span class="ptime">2014-10-05 23:15发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="4369629" username="bornjasoncen"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/bornjasoncen" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_bornjasoncen.jpg" width="40" height="40"></a></dd><dd class="comment_body">这哥们是大神</dd></dl><dl class="comment_item comment_topic" id="comment_item_4156577"><dt class="comment_head" floor="34">34楼 <span class="user"><a class="username" href="http://blog.csdn.net/westerneastern" target="_blank">westerneastern</a> <span class="ptime">2014-08-09 21:16发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4156577" username="westerneastern"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/westerneastern" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_westerneastern.jpg" width="40" height="40"></a></dd><dd class="comment_body">谢谢分享</dd></dl><dl class="comment_item comment_topic" id="comment_item_4145057"><dt class="comment_head" floor="33">33楼 <span class="user"><a class="username" href="http://blog.csdn.net/sinking93" target="_blank">sinking93</a> <span class="ptime">2014-08-06 15:18发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4145057" username="sinking93"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/sinking93" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_sinking93.jpg" width="40" height="40"></a></dd><dd class="comment_body">挑一个小毛病，ContextImpl和ContextWrapper是一种关联关系而非依赖关系，大概是吧</dd></dl><dl class="comment_item comment_topic" id="comment_item_4143615"><dt class="comment_head" floor="32">32楼 <span class="user"><a class="username" href="http://blog.csdn.net/u011028672" target="_blank">用相机留住生活</a> <span class="ptime">2014-08-06 10:10发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4143615" username="u011028672"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011028672" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011028672.jpg" width="40" height="40"></a></dd><dd class="comment_body">写的比Android内核剖析的好多了，那本书我完全看不懂。<br>而一个App里的<br>所有ContextIml实例，都对应同一个packageInfo对象<br>这句话怎么理解？不是很多各类里面有很多个隐藏的对象吗</dd></dl><dl class="comment_item comment_topic" id="comment_item_4042213"><dt class="comment_head" floor="31">31楼 <span class="user"><a class="username" href="http://blog.csdn.net/u014525108" target="_blank">u014525108</a> <span class="ptime">2014-07-12 22:08发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="4042213" username="u014525108"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u014525108" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u014525108.jpg" width="40" height="40"></a></dd><dd class="comment_body">博主，我学习android感觉很吃力，但是我没有看源代码的习惯，总是喜欢到百度里面看别人的分享，可以教教我关于如何学习android的方法吗。不胜感激</dd></dl><dl class="comment_item comment_topic" id="comment_item_3951879"><dt class="comment_head" floor="30">30楼 <span class="user"><a class="username" href="http://blog.csdn.net/lyzhuxl" target="_blank">朱小童</a> <span class="ptime">2014-06-13 08:34发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3951879" username="lyzhuxl"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/lyzhuxl" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_lyzhuxl.jpg" width="40" height="40"></a></dd><dd class="comment_body">写的不错</dd></dl><dl class="comment_item comment_topic" id="comment_item_3844609"><dt class="comment_head" floor="29">29楼 <span class="user"><a class="username" href="http://blog.csdn.net/ykttt1" target="_blank">_Obsession</a> <span class="ptime">2014-05-16 14:39发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3844609" username="ykttt1"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/ykttt1" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_ykttt1.jpg" width="40" height="40"></a></dd><dd class="comment_body">写的非常好</dd></dl><dl class="comment_item comment_topic" id="comment_item_3808851"><dt class="comment_head" floor="28">28楼 <span class="user"><a class="username" href="http://blog.csdn.net/tbz888" target="_blank">Tangbzh</a> <span class="ptime">2014-05-04 14:32发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3808851" username="tbz888"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/tbz888" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_tbz888.jpg" width="40" height="40"></a></dd><dd class="comment_body">感谢分享，排版不错</dd></dl><dl class="comment_item comment_topic" id="comment_item_3717557"><dt class="comment_head" floor="27">27楼 <span class="user"><a class="username" href="http://blog.csdn.net/u014264008" target="_blank">苇子的心是空的</a> <span class="ptime">2014-04-08 17:24发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3717557" username="u014264008"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u014264008" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u014264008.jpg" width="40" height="40"></a></dd><dd class="comment_body">恩，很详细的</dd></dl><dl class="comment_item comment_topic" id="comment_item_3598085"><dt class="comment_head" floor="26">26楼 <span class="user"><a class="username" href="http://blog.csdn.net/u010261586" target="_blank">3849</a> <span class="ptime">2014-03-17 14:21发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3598085" username="u010261586"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u010261586" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u010261586.jpg" width="40" height="40"></a></dd><dd class="comment_body">谢谢博主，写得不错，对我有启发！</dd></dl><dl class="comment_item comment_topic" id="comment_item_3499709"><dt class="comment_head" floor="25">25楼 <span class="user"><a class="username" href="http://blog.csdn.net/yunxiaoxiaoyun" target="_blank">Miles_Li</a> <span class="ptime">2014-02-20 15:23发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3499709" username="yunxiaoxiaoyun"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/yunxiaoxiaoyun" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_yunxiaoxiaoyun.jpg" width="40" height="40"></a></dd><dd class="comment_body">写的真好，支持支持</dd></dl><dl class="comment_item comment_topic" id="comment_item_3460505"><dt class="comment_head" floor="24">24楼 <span class="user"><a class="username" href="http://blog.csdn.net/knight_ysq" target="_blank">knight_ysq</a> <span class="ptime">2014-02-05 20:14发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3460505" username="knight_ysq"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/knight_ysq" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_knight_ysq.jpg" width="40" height="40"></a></dd><dd class="comment_body">写的很好~~~</dd></dl><dl class="comment_item comment_topic" id="comment_item_3380537"><dt class="comment_head" floor="23">23楼 <span class="user"><a class="username" href="http://blog.csdn.net/u013262760" target="_blank">jasonlhunter</a> <span class="ptime">2014-01-07 17:13发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3380537" username="u013262760"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u013262760" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u013262760.jpg" width="40" height="40"></a></dd><dd class="comment_body">mark</dd></dl><dl class="comment_item comment_topic" id="comment_item_3376943"><dt class="comment_head" floor="22">22楼 <span class="user"><a class="username" href="http://blog.csdn.net/u011003792" target="_blank">Freedom229</a> <span class="ptime">2014-01-06 17:45发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3376943" username="u011003792"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011003792" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011003792.jpg" width="40" height="40"></a></dd><dd class="comment_body">学习中，mark下，谢谢博主</dd></dl><dl class="comment_item comment_topic" id="comment_item_3153347"><dt class="comment_head" floor="21">21楼 <span class="user"><a class="username" href="http://blog.csdn.net/u012566958" target="_blank">Dingo妹</a> <span class="ptime">2013-11-16 16:57发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3153347" username="u012566958"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u012566958" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u012566958.jpg" width="40" height="40"></a></dd><dd class="comment_body">学习中，mark下，谢谢博主</dd></dl><dl class="comment_item comment_topic" id="comment_item_3138269"><dt class="comment_head" floor="20">20楼 <span class="user"><a class="username" href="http://blog.csdn.net/u011003792" target="_blank">Freedom229</a> <span class="ptime">2013-11-12 14:02发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3138269" username="u011003792"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011003792" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011003792.jpg" width="40" height="40"></a></dd><dd class="comment_body">大致明白一点，但是不明白这些东西对于写代码有哪些作用或者意义！求解。。。。。。。</dd></dl><dl class="comment_item comment_topic" id="comment_item_3039867"><dt class="comment_head" floor="19">19楼 <span class="user"><a class="username" href="http://blog.csdn.net/u012604992" target="_blank">zhqcqupt</a> <span class="ptime">2013-10-28 20:58发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3039867" username="u012604992"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u012604992" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u012604992.jpg" width="40" height="40"></a></dd><dd class="comment_body">应该是你的地图mapview 利用上下文绑定了一个所在活动的一个资源，也就是说mapview有了这个活动的引用，但是这个mapview的生命周期比所在的activity长，这样，activity就不能正常走过它的生命周秋，在活动资源被释放的时候出错。所以要通过应用程序上下文引用资源，这样mapview的生命周期与所在活动无关了，活动也就被正常释放了。</dd></dl><dl class="comment_item comment_topic" id="comment_item_2931007"><dt class="comment_head" floor="18">18楼 <span class="user"><a class="username" href="http://blog.csdn.net/asking1233" target="_blank">asking1233</a> <span class="ptime">2013-09-22 02:13发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2931007" username="asking1233"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/asking1233" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_asking1233.jpg" width="40" height="40"></a></dd><dd class="comment_body">楼主 其实我只是想知道，Context  和 ApplicationContext的区别，因为我在做项目的时候，发现了一个很奇怪的问题，就是在tabhost中，加载地图，一定要LocClient(getApplicationContext())，不能用普通的this（也就是Context）我搞不懂啊，我用的是百度地图，但是用另外Activity启动这个Activity的时候，就可以定位了，是不是就是说，Context这个东西，不单单跟当前对象有关，也就是说跟它前一个对象有关系，是不是我理解的有问题，楼主请指教啊</dd><dl class="comment_item comment_reply" id="comment_item_3039873"><dt class="comment_head" floor="18">Re: <span class="user"><a class="username" href="http://blog.csdn.net/u012604992" target="_blank">zhqcqupt</a> <span class="ptime">2013-10-28 20:59发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3039873" username="u012604992"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u012604992" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u012604992.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复asking1233：应该是你的地图mapview 利用上下文绑定了一个所在活动的一个资源，也就是说mapview有了这个活动的引用，但是这个mapview的生命周期比所在的activity长，这样，activity就不能正常走过它的生命周期，在活动资源被释放的时候出错。所以要通过应用程序上下文引用资源，这样mapview的生命周期与所在活动无关了，活动也就被正常释放了。</dd><dl class="comment_item comment_reply" id="comment_item_3043763"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/asking1233" target="_blank">asking1233</a> <span class="ptime">2013-10-29 19:10发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="3043763" username="asking1233"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/asking1233" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_asking1233.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复zhqcqupt：你说的有道理，可是还有一个问题，这个mapview是这个活动下的一个实例变量，那他们的生命周期怎么会不一样呢，还有我用startActivity启动的时候跟tabhost加载一个Activity这两个有什么不同呢,求指教啊</dd><dl class="comment_item comment_reply" id="comment_item_3522535"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/gqs519" target="_blank">挤不上公交车的路人甲</a> <span class="ptime">2014-02-27 11:48发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="3522535" username="gqs519"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/gqs519" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_gqs519.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复asking1233：比Activity生命周期长的不是mapview 是定位服务</dd></dl></dl></dl></dl><dl class="comment_item comment_topic" id="comment_item_2895949"><dt class="comment_head" floor="17">17楼 <span class="user"><a class="username" href="http://blog.csdn.net/Yolanda8766" target="_blank">Yolanda8766</a> <span class="ptime">2013-09-06 10:33发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2895949" username="Yolanda8766"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/Yolanda8766" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_yolanda8766.jpg" width="40" height="40"></a></dd><dd class="comment_body">果然，我看不懂</dd></dl><dl class="comment_item comment_topic" id="comment_item_2749199"><dt class="comment_head" floor="16">16楼 <span class="user"><a class="username" href="http://blog.csdn.net/u011026237" target="_blank">本草洋葱</a> <span class="ptime">2013-07-22 22:20发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2749199" username="u011026237"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011026237" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011026237.jpg" width="40" height="40"></a></dd><dd class="comment_body">想问个问题，能在Receiver里面发短信吗？PendingIntent.getBroadcast(this, 0, sendIntent, 0);如果用this是不行的，换成onReceive()方法里的 context也没有成功</dd><dl class="comment_item comment_reply" id="comment_item_2750081"><dt class="comment_head" floor="16">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2013-07-23 10:27发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2750081" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复本草洋葱：onReceive(context, ) 的Context对象指代的是该Appl中存在的一个Context，或许是Application,可以输出看看。可以正常发送短信的，或许权限不足？</dd><dl class="comment_item comment_reply" id="comment_item_2754745"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/u011026237" target="_blank">本草洋葱</a> <span class="ptime">2013-07-24 15:35发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2754745" username="u011026237"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011026237" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011026237.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复qinjuning：多谢，已经解决</dd></dl></dl></dl><dl class="comment_item comment_topic" id="comment_item_2711995"><dt class="comment_head" floor="15">15楼 <span class="user"><a class="username" href="http://blog.csdn.net/leizuishuai201314" target="_blank">第一滴泪</a> <span class="ptime">2013-07-05 17:44发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2711995" username="leizuishuai201314"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/leizuishuai201314" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_leizuishuai201314.jpg" width="40" height="40"></a></dd><dd class="comment_body">其它的都讲得很好，但是对于最后<br><br>“另外，需要强调一点的是，通过对ContextImp的分析可知，其方法的大多数操作都是直接调用其属性mPackageInfo(该属性类型为PackageInfo)的相关方法而来”  这句话不苟同啊 ， PackageInfo 里面几乎没有任何实现。</dd><dl class="comment_item comment_reply" id="comment_item_2750059"><dt class="comment_head" floor="15">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2013-07-23 10:23发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2750059" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复第一滴泪： //所有Application程序公用一个mPackageInfo对象     /*package*/ ActivityThread.PackageInfo mPackageInfo;   不是	android.content.pm.PackageInfo类。可以研究哈。</dd></dl></dl><dl class="comment_item comment_topic" id="comment_item_2688931"><dt class="comment_head" floor="14">14楼 <span class="user"><a class="username" href="http://blog.csdn.net/suchttta" target="_blank">suchttta</a> <span class="ptime">2013-06-24 16:39发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2688931" username="suchttta"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/suchttta" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_suchttta.jpg" width="40" height="40"></a></dd><dd class="comment_body">楼主我想问一个问题，我一个app应用没有Activity，是做成后台运行的Service,但是在服务中无法使用startActivityForResult()方法,该方法只存在Activity中,将Service的context强制类型转换为Activity对象也不行.望指点</dd><dl class="comment_item comment_reply" id="comment_item_2689331"><dt class="comment_head" floor="14">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2013-06-24 20:31发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2689331" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复suchttta：这个当然不行的，Service和Activity属于不同的类。在Service中不能使用startActivityForResult()，不同的Task之间也不能使用。你可以换个方式，例如：全局Handler，广播等实现。</dd><dl class="comment_item comment_reply" id="comment_item_2690513"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/suchttta" target="_blank">suchttta</a> <span class="ptime">2013-06-25 13:58发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2690513" username="suchttta"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/suchttta" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_suchttta.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复qinjuning：噢，原来是这么一回事。我现在的情况是，这个app没有Activity，一启动就是Service,我想在这个Service中打开设备管理器(DevicePolicyManager),开始用startActivityForResult()不行,之后我换了一种方式:<br>Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);<br>		intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName);<br>		intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "打开设备管理器");<br>		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); <br>		context.startActivity(intent); <br><br>这会是没有报错了,但是就是没有效果.您知道如何解决吗?<br><br>如果不加intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 这条语句就会报错:<br>06-25 13:57:35.549: E/AndroidRuntime(7746): Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?<br><br>现在纠结着呢</dd><dl class="comment_item comment_reply" id="comment_item_2715799"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/u011133213" target="_blank">胖虎</a> <span class="ptime">2013-07-08 09:13发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2715799" username="u011133213"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/u011133213" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_u011133213.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复suchttta：我觉得应该来说是Activity被使用在后台了？？？<br>试试下面两种：<br>1.<br>intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);<br>2.<br>intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  <br>            intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);</dd></dl></dl></dl></dl><dl class="comment_item comment_topic" id="comment_item_2658487"><dt class="comment_head" floor="13">13楼 <span class="user"><a class="username" href="http://blog.csdn.net/jack_tianzhenhai" target="_blank">jack_tianzhenhai</a> <span class="ptime">2013-06-06 17:32发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2658487" username="jack_tianzhenhai"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/jack_tianzhenhai" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_jack_tianzhenhai.jpg" width="40" height="40"></a></dd><dd class="comment_body">楼主写的很好，学习了。<br>有个问题想和楼主讨论一下，在Activity中我们通常可以获取的Application的context实例，这个实例也可以实现对资源调用等功能。我们通常使用的时候是用Activity自身的context好还是用application中的？</dd><dl class="comment_item comment_reply" id="comment_item_2673327"><dt class="comment_head" floor="13">Re: <span class="user"><a class="username" href="http://blog.csdn.net/leehong2005" target="_blank">leehong2005</a> <span class="ptime">2013-06-15 16:37发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2673327" username="leehong2005"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/leehong2005" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_leehong2005.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复jack_tianzhenhai：我来回复你：通常情况下appliction context与activity的context用法没有太大区别，只是app的context生命周期长于activity。如果你想保存一个静态全局的资源的话，你不能使用activity的context。这样会导致内存泄露。</dd></dl></dl><dl class="comment_item comment_topic" id="comment_item_2655455"><dt class="comment_head" floor="12">12楼 <span class="user"><a class="username" href="http://blog.csdn.net/pillow_zhou" target="_blank">pillow_zhou</a> <span class="ptime">2013-06-05 13:35发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2655455" username="pillow_zhou"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/pillow_zhou" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_pillow_zhou.jpg" width="40" height="40"></a></dd><dd class="comment_body">楼主写的很好，但是我还有个疑问，就是这三种方式得到的Context有什么区别呢？</dd><dl class="comment_item comment_reply" id="comment_item_2673369"><dt class="comment_head" floor="12">Re: <span class="user"><a class="username" href="http://blog.csdn.net/leehong2005" target="_blank">leehong2005</a> <span class="ptime">2013-06-15 17:01发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2673369" username="leehong2005"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/leehong2005" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_leehong2005.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复pillow_zhou：哪有里有三种方式？不明白，请指教</dd></dl></dl><dl class="comment_item comment_topic" id="comment_item_2655265"><dt class="comment_head" floor="11">11楼 <span class="user"><a class="username" href="http://blog.csdn.net/HeeLoo1" target="_blank">HeeLoo1</a> <span class="ptime">2013-06-05 11:41发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2655265" username="HeeLoo1"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/HeeLoo1" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_heeloo1.jpg" width="40" height="40"></a></dd><dd class="comment_body">虽然很深奥，但是解决了我的问题</dd></dl><dl class="comment_item comment_topic" id="comment_item_2636986"><dt class="comment_head" floor="10">10楼 <span class="user"><a class="username" href="http://blog.csdn.net/hejinya" target="_blank">hejinya</a> <span class="ptime">2013-05-21 17:45发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2636986" username="hejinya"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/hejinya" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_hejinya.jpg" width="40" height="40"></a></dd><dd class="comment_body">你好，问一下，android4.0以上版本ContextIml类在哪个地方，这个地方是不是跟2.3以前实现不同了，我没发现这个类</dd><dl class="comment_item comment_reply" id="comment_item_2638269"><dt class="comment_head" floor="10">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2013-05-22 17:39发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2638269" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复hejinya：额，写错了，是ContextImpl类。 命名方式你懂的。可以搜搜Context类的继承结构的。</dd><dl class="comment_item comment_reply" id="comment_item_2673373"><dt class="comment_head" floor="1">Re: <span class="user"><a class="username" href="http://blog.csdn.net/leehong2005" target="_blank">leehong2005</a> <span class="ptime">2013-06-15 17:02发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2673373" username="leehong2005"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/leehong2005" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_leehong2005.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复qinjuning：在高版本的系统中，有些类都重命名了。比如在2.3上，ViewRoot，但是4.0以上，改名为ViewRootImpl。</dd></dl></dl></dl><dl class="comment_item comment_topic" id="comment_item_2620600"><dt class="comment_head" floor="9">9楼 <span class="user"><a class="username" href="http://blog.csdn.net/franksunny" target="_blank">franksunny</a> <span class="ptime">2013-05-08 10:45发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2620600" username="franksunny"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/franksunny" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_franksunny.jpg" width="40" height="40"></a></dd><dd class="comment_body">你比书上将的更加浅显和易于理解。消化的挺好的。</dd></dl><dl class="comment_item comment_topic" id="comment_item_2617919"><dt class="comment_head" floor="8">8楼 <span class="user"><a class="username" href="http://blog.csdn.net/heimantou1" target="_blank">heimantou1</a> <span class="ptime">2013-05-06 11:36发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2617919" username="heimantou1"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/heimantou1" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_heimantou1.jpg" width="40" height="40"></a></dd><dd class="comment_body">学习了。</dd></dl><dl class="comment_item comment_topic" id="comment_item_2569501"><dt class="comment_head" floor="7">7楼 <span class="user"><a class="username" href="http://blog.csdn.net/telencool" target="_blank">Joe_n</a> <span class="ptime">2013-03-27 18:00发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2569501" username="telencool"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/telencool" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_telencool.jpg" width="40" height="40"></a></dd><dd class="comment_body">刚好搜到有关Context类的解析，很有帮助，正迷惑呢！</dd></dl><dl class="comment_item comment_topic" id="comment_item_2484905"><dt class="comment_head" floor="6">6楼 <span class="user"><a class="username" href="http://blog.csdn.net/Linus_Xie" target="_blank">Linus_Xie</a> <span class="ptime">2012-12-28 11:00发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2484905" username="Linus_Xie"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/Linus_Xie" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_linus_xie.jpg" width="40" height="40"></a></dd><dd class="comment_body">鸟蛋路过，以后多多向前辈学习。。。嘿嘿。。。</dd></dl><dl class="comment_item comment_topic" id="comment_item_2377876"><dt class="comment_head" floor="5">5楼 <span class="user"><a class="username" href="http://blog.csdn.net/zy_zhangyuan88" target="_blank">zy_zhangyuan88</a> <span class="ptime">2012-09-20 16:36发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2377876" username="zy_zhangyuan88"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/zy_zhangyuan88" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_zy_zhangyuan88.jpg" width="40" height="40"></a></dd><dd class="comment_body">有这个书的电子书吗？</dd></dl><dl class="comment_item comment_topic" id="comment_item_2298806"><dt class="comment_head" floor="4">4楼 <span class="user"><a class="username" href="http://blog.csdn.net/newcman" target="_blank">newcman</a> <span class="ptime">2012-07-24 23:28发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display:none;" commentid="2298806" username="newcman"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/newcman" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_newcman.jpg" width="40" height="40"></a></dd><dd class="comment_body">学楼主，果断买书！</dd></dl><dl class="comment_item comment_topic" id="comment_item_2297594"><dt class="comment_head" floor="3">3楼 <span class="user"><a class="username" href="http://blog.csdn.net/fchangfa" target="_blank">fchangfa</a> <span class="ptime">2012-07-24 11:01发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2297594" username="fchangfa"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/fchangfa" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_fchangfa.jpg" width="40" height="40"></a></dd><dd class="comment_body">很好！博主的Android功底应该不错，以后还需要多指点。rss了。</dd><dl class="comment_item comment_reply" id="comment_item_2306605"><dt class="comment_head" floor="3">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2012-07-26 09:02发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2306605" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复fchangfa：  还是菜鸟啊。多多沟通交流。</dd></dl></dl><dl class="comment_item comment_topic" id="comment_item_2149908"><dt class="comment_head" floor="2">2楼 <span class="user"><a class="username" href="http://blog.csdn.net/banxi1988" target="_blank">banxi</a> <span class="ptime">2012-03-31 10:10发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2149908" username="banxi1988"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/banxi1988" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_banxi1988.jpg" width="40" height="40"></a></dd><dd class="comment_body">学习SharedPreferences的时候,想了解下源代码,找了下找不到.哈哈,然后在这里看到了,谢谢!</dd><dl class="comment_item comment_reply" id="comment_item_2150133"><dt class="comment_head" floor="2">Re: <span class="user"><a class="username" href="http://blog.csdn.net/qinjuning" target="_blank">qinjuning</a> <span class="ptime">2012-03-31 12:32发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2150133" username="qinjuning"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/qinjuning" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_qinjuning.jpg" width="40" height="40"></a></dd><dd class="comment_body">回复banxi：无心插柳柳成荫咯。是不是改把博客的标题变长点，呵呵。多看源码进步快，加油。</dd></dl></dl><dl class="comment_item comment_topic" id="comment_item_2144309"><dt class="comment_head" floor="1">1楼 <span class="user"><a class="username" href="http://blog.csdn.net/gejisit" target="_blank">Greg-Ge</a> <span class="ptime">2012-03-26 17:41发表</span>  <a href="http://blog.csdn.net/qinjuning/article/details/7310620#reply" class="cmt_btn reply" title="回复">[回复]</a> <span class="comment_manage" style="display: none;" commentid="2144309" username="gejisit"> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#quote" class="cmt_btn quote" title="引用">[引用]</a> <a href="http://blog.csdn.net/qinjuning/article/details/7310620#report" class="cmt_btn report" title="举报">[举报]</a></span></span></dt><dd class="comment_userface"><a href="http://blog.csdn.net/gejisit" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/3_gejisit.jpg" width="40" height="40"></a></dd><dd class="comment_body">精辟</dd></dl><div class="clear"></div></div>
    <div id="comment_bar" style="display: none;">
    </div>
    <div id="comment_form"><div class="guest_link">您还没有登录,请<a href="javascript:void(0);" onclick="javascript:loginbox();">[登录]</a>或<a href="http://passport.csdn.net/account/register?from=http%3A%2F%2Fblog.csdn.net%2Fqinjuning%2Farticle%2Fdetails%2F7310620">[注册]</a></div></div>

    <div class="announce">
        * 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场<a name="reply"></a><a name="quote"></a></div>
</div>

<script type="text/javascript">
    var fileName = '7310620';
    var commentscount = 57;
    var islock = false
</script>
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/comment.js"></script>
    <div id="ad_bot">
    <iframe id="ad_frm_1" frameborder="0" scrolling="no" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ad(1).html" style="border-width: 0px; overflow: hidden; width: 794px; height: 0px;"></iframe></div>
    <script type="text/javascript">
    new Ad(5, 'ad_bot');
    </script>
<div id="report_dialog">
</div>

<div id="d-top" style="bottom:60px;">
        <a id="quick-reply" class="btn btn-top q-reply" title="快速回复" style="display:none;">
            <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/blog-icon-reply.png" alt="快速回复">
        </a>    

    <a id="d-top-a" class="btn btn-top backtop" style="display: none;" title="返回顶部" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_huidaodingbu&#39;])">         
         <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/top.png" alt="TOP">
    </a>
</div>
<script type="text/javascript">
    $(function ()
    {
        $("#ad_frm_0").height("90px");
        
        setTimeout(function(){
            $("#ad_frm_2").height("200px");
        },1000);
        
        /*
        if($("#comment_content").length>0)
        {
            $("#quick-reply").show();

            $("#quick-reply").click(function(){
                setEditorFocus();
            });
        }       
     
        var d_top = $('#d-top-a');

        document.onscroll = function ()
        {
            var scrTop = (document.body.scrollTop || document.documentElement.scrollTop);
            if (scrTop > 500)
            {
                d_top.show();
            } else
            {
                d_top.hide();
            }
        }
        $('#d-top-a').click(function ()
        {
            scrollTo(0, 0);
            this.blur();
            return false;
        });
        */
    });
  
</script>
<style type="text/css">
    .tag_list
    {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #D7CBC1;
        color: #000000;
        font-size: 12px;
        line-height: 20px;
        list-style: none outside none;
        margin: 10px 2% 0 1%;
        padding: 1px;
    }
    .tag_list h5
    {
        background: none repeat scroll 0 0 #E0DBD3;
        color: #47381C;
        font-size: 12px;
        height: 24px;
        line-height: 24px;
        padding: 0 5px;
        margin: 0;
    }
    .tag_list h5 a
    {
        color: #47381C;
    }
    .classify
    {
        margin: 10px 0;
        padding: 4px 12px 8px;
    }
    .classify a
    {
        margin-right: 20px;
        white-space: nowrap;
    }
</style>
<div class="tag_list">
    <h5>
        <a href="http://www.csdn.net/tag/" target="_blank">核心技术类目</a></h5>
    <div class="classify">
<a title="全部主题" href="http://www.csdn.net/tag" target="_blank" onclick="LogClickCount(this,336);">全部主题</a>
<a title="Hadoop" href="http://g.csdn.net/5272865" target="_blank" onclick="LogClickCount(this,336);">Hadoop</a>
<a title="AWS" href="http://g.csdn.net/5272866" target="_blank" onclick="LogClickCount(this,336);">AWS</a>
<a title="移动游戏" href="http://g.csdn.net/5272870" target="_blank" onclick="LogClickCount(this,336);">移动游戏</a>
<a title="Java" href="http://g.csdn.net/5272871" target="_blank" onclick="LogClickCount(this,336);">Java</a>
<a title="Android" href="http://g.csdn.net/5272872" target="_blank" onclick="LogClickCount(this,336);">Android</a>
<a title="iOS" href="http://g.csdn.net/5272873" target="_blank" onclick="LogClickCount(this,336);">iOS</a>
<a title="Swift" href="http://g.csdn.net/5272868" target="_blank" onclick="LogClickCount(this,336);">Swift</a>
<a title="智能硬件" href="http://g.csdn.net/5272869" target="_blank" onclick="LogClickCount(this,336);">智能硬件</a>
<a title="Docker" href="http://g.csdn.net/5272867" target="_blank" onclick="LogClickCount(this,336);">Docker</a>
<a title="OpenStack" href="http://g.csdn.net/5272925" target="_blank" onclick="LogClickCount(this,336);">OpenStack</a>
<a title="VPN" href="http://www.csdn.net/tag/vpn" target="_blank" onclick="LogClickCount(this,336);">VPN</a>
<a title="Spark" href="http://g.csdn.net/5272924" target="_blank" onclick="LogClickCount(this,336);">Spark</a>
<a title="ERP" href="http://www.csdn.net/tag/erp" target="_blank" onclick="LogClickCount(this,336);">ERP</a>
<a title="IE10" href="http://www.csdn.net/tag/ie10" target="_blank" onclick="LogClickCount(this,336);">IE10</a>
<a title="Eclipse" href="http://www.csdn.net/tag/eclipse" target="_blank" onclick="LogClickCount(this,336);">Eclipse</a>
<a title="CRM" href="http://www.csdn.net/tag/crm" target="_blank" onclick="LogClickCount(this,336);">CRM</a>
<a title="JavaScript" href="http://www.csdn.net/tag/javascript" target="_blank" onclick="LogClickCount(this,336);">JavaScript</a>
<a title="数据库" href="http://www.csdn.net/tag/%E6%95%B0%E6%8D%AE%E5%BA%93" target="_blank" onclick="LogClickCount(this,336);">数据库</a>
<a title="Ubuntu" href="http://www.csdn.net/tag/ubuntu" target="_blank" onclick="LogClickCount(this,336);">Ubuntu</a>
<a title="NFC" href="http://www.csdn.net/tag/nfc" target="_blank" onclick="LogClickCount(this,336);">NFC</a>
<a title="WAP" href="http://www.csdn.net/tag/wap" target="_blank" onclick="LogClickCount(this,336);">WAP</a>
<a title="jQuery" href="http://www.csdn.net/tag/jquery" target="_blank" onclick="LogClickCount(this,336);">jQuery</a>
<a title="BI" href="http://www.csdn.net/tag/bi" target="_blank" onclick="LogClickCount(this,336);">BI</a>
<a title="HTML5" href="http://www.csdn.net/tag/html5" target="_blank" onclick="LogClickCount(this,336);">HTML5</a>
<a title="Spring" href="http://www.csdn.net/tag/spring" target="_blank" onclick="LogClickCount(this,336);">Spring</a>
<a title="Apache" href="http://www.csdn.net/tag/apache" target="_blank" onclick="LogClickCount(this,336);">Apache</a>
<a title=".NET" href="http://www.csdn.net/tag/.net" target="_blank" onclick="LogClickCount(this,336);">.NET</a>
<a title="API" href="http://www.csdn.net/tag/api" target="_blank" onclick="LogClickCount(this,336);">API</a>
<a title="HTML" href="http://www.csdn.net/tag/html" target="_blank" onclick="LogClickCount(this,336);">HTML</a>
<a title="SDK" href="http://www.csdn.net/tag/sdk" target="_blank" onclick="LogClickCount(this,336);">SDK</a>
<a title="IIS" href="http://www.csdn.net/tag/iis" target="_blank" onclick="LogClickCount(this,336);">IIS</a>
<a title="Fedora" href="http://www.csdn.net/tag/fedora" target="_blank" onclick="LogClickCount(this,336);">Fedora</a>
<a title="XML" href="http://www.csdn.net/tag/xml" target="_blank" onclick="LogClickCount(this,336);">XML</a>
<a title="LBS" href="http://www.csdn.net/tag/lbs" target="_blank" onclick="LogClickCount(this,336);">LBS</a>
<a title="Unity" href="http://www.csdn.net/tag/unity" target="_blank" onclick="LogClickCount(this,336);">Unity</a>
<a title="Splashtop" href="http://www.csdn.net/tag/splashtop" target="_blank" onclick="LogClickCount(this,336);">Splashtop</a>
<a title="UML" href="http://www.csdn.net/tag/uml" target="_blank" onclick="LogClickCount(this,336);">UML</a>
<a title="components" href="http://www.csdn.net/tag/components" target="_blank" onclick="LogClickCount(this,336);">components</a>
<a title="Windows Mobile" href="http://www.csdn.net/tag/windowsmobile" target="_blank" onclick="LogClickCount(this,336);">Windows Mobile</a>
<a title="Rails" href="http://www.csdn.net/tag/rails" target="_blank" onclick="LogClickCount(this,336);">Rails</a>
<a title="QEMU" href="http://www.csdn.net/tag/qemu" target="_blank" onclick="LogClickCount(this,336);">QEMU</a>
<a title="KDE" href="http://www.csdn.net/tag/kde" target="_blank" onclick="LogClickCount(this,336);">KDE</a>
<a title="Cassandra" href="http://www.csdn.net/tag/cassandra" target="_blank" onclick="LogClickCount(this,336);">Cassandra</a>
<a title="CloudStack" href="http://www.csdn.net/tag/cloudstack" target="_blank" onclick="LogClickCount(this,336);">CloudStack</a>
<a title="FTC" href="http://www.csdn.net/tag/ftc" target="_blank" onclick="LogClickCount(this,336);">FTC</a>
<a title="coremail" href="http://www.csdn.net/tag/coremail" target="_blank" onclick="LogClickCount(this,336);">coremail</a>
<a title="OPhone " href="http://www.csdn.net/tag/ophone" target="_blank" onclick="LogClickCount(this,336);">OPhone </a>
<a title="CouchBase" href="http://www.csdn.net/tag/couchbase" target="_blank" onclick="LogClickCount(this,336);">CouchBase</a>
<a title="云计算" href="http://www.csdn.net/tag/%E4%BA%91%E8%AE%A1%E7%AE%97" target="_blank" onclick="LogClickCount(this,336);">云计算</a>
<a title="iOS6" href="http://www.csdn.net/tag/iOS6" target="_blank" onclick="LogClickCount(this,336);">iOS6</a>
<a title="Rackspace " href="http://www.csdn.net/tag/rackspace" target="_blank" onclick="LogClickCount(this,336);">Rackspace </a>
<a title="Web App" href="http://www.csdn.net/tag/webapp" target="_blank" onclick="LogClickCount(this,336);">Web App</a>
<a title="SpringSide" href="http://www.csdn.net/tag/springside" target="_blank" onclick="LogClickCount(this,336);">SpringSide</a>
<a title="Maemo" href="http://www.csdn.net/tag/maemo" target="_blank" onclick="LogClickCount(this,336);">Maemo</a>
<a title="Compuware" href="http://www.csdn.net/tag/compuware" target="_blank" onclick="LogClickCount(this,336);">Compuware</a>
<a title="大数据" href="http://www.csdn.net/tag/%E5%A4%A7%E6%95%B0%E6%8D%AE" target="_blank" onclick="LogClickCount(this,336);">大数据</a>
<a title="aptech" href="http://www.csdn.net/tag/aptech" target="_blank" onclick="LogClickCount(this,336);">aptech</a>
<a title="Perl" href="http://www.csdn.net/tag/perl" target="_blank" onclick="LogClickCount(this,336);">Perl</a>
<a title="Tornado" href="http://www.csdn.net/tag/tornado" target="_blank" onclick="LogClickCount(this,336);">Tornado</a>
<a title="Ruby" href="http://www.csdn.net/tag/ruby" target="_blank" onclick="LogClickCount(this,336);">Ruby</a>
<a title="Hibernate" href="http://www.csdn.net/hibernate" target="_blank" onclick="LogClickCount(this,336);">Hibernate</a>
<a title="ThinkPHP" href="http://www.csdn.net/tag/thinkphp" target="_blank" onclick="LogClickCount(this,336);">ThinkPHP</a>
<a title="HBase" href="http://www.csdn.net/tag/hbase" target="_blank" onclick="LogClickCount(this,336);">HBase</a>
<a title="Pure" href="http://www.csdn.net/tag/pure" target="_blank" onclick="LogClickCount(this,336);">Pure</a>
<a title="Solr" href="http://www.csdn.net/tag/solr" target="_blank" onclick="LogClickCount(this,336);">Solr</a>
<a title="Angular" href="http://www.csdn.net/tag/angular" target="_blank" onclick="LogClickCount(this,336);">Angular</a>
<a title="Cloud Foundry" href="http://www.csdn.net/tag/cloudfoundry" target="_blank" onclick="LogClickCount(this,336);">Cloud Foundry</a>
<a title="Redis" href="http://www.csdn.net/tag/redis" target="_blank" onclick="LogClickCount(this,336);">Redis</a>
<a title="Scala" href="http://www.csdn.net/tag/scala" target="_blank" onclick="LogClickCount(this,336);">Scala</a>
<a title="Django" href="http://www.csdn.net/tag/django" target="_blank" onclick="LogClickCount(this,336);">Django</a>
<a title="Bootstrap" href="http://www.csdn.net/tag/bootstrap" target="_blank" onclick="LogClickCount(this,336);">Bootstrap</a>
    </div>
</div>

<div id="pop_win" style="display:none ;position: absolute; z-index: 10000; border: 1px solid rgb(220, 220, 220); top: 222.5px; left: 630px; opacity: 1; background: none 0px 0px repeat scroll rgb(255, 255, 255);">
    
</div>
<div id="popup_mask"></div>
<style>
    #popup_mask
    {
        position: absolute;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        left: 0px;
        top: 0px;
        opacity: 0.3;
        filter: alpha(opacity=30);
        display: none;
    }

</style>




<script type="text/javascript">
    $(function(){
        setTimeout(function(){
            $(".comment_body:contains('回复')").each(function(index,item){
                var u=$(this).text().split('：')[0].toString().replace("回复","")
                var thisComment=$(this);
                if(u)
                {
                    $.getJSON("https://passport.csdn.net/get/nick?callback=?", {users: u}, function(a) {
                        if(a!=null&&a.data!=null&&a.data.length>0)
                        {
                            nick=a.data[0].n; 
                            if(u!=nick)
                            {
                                thisComment.text(thisComment.text().replace(u,nick));  
                            }
                        }       
                    });  
                }
            });
        },200);  
        
        setTimeout(function(){
            $("a img[src='http://js.tongji.linezing.com/stats.gif']").parent().css({"position":"absolute","left":"50%"});
        },300);
    });

    function loginbox(){
        var $logpop=$("#pop_win");
        $logpop.html('<iframe src="https://passport.csdn.net/account/loginbox?service=http://static.blog.csdn.net/callback.htm" frameborder="0" height="600" width="400" scrolling="no"></iframe>');

        $('#popup_mask').css({
            opacity: 0.5,
            width: $( document ).width() + 'px',
            height:  $( document ).height() + 'px'
        });
        $('#popup_mask').css("display","block");
 
        $logpop.css( {
            top: ($( window ).height() - $logpop.height())/ 2  + $( window 
       ).scrollTop() + 'px',
            left:($( window ).width() - $logpop.width())/ 2
        } );
 
        setTimeout( function () {
            $logpop.show();
            $logpop.css( {
                opacity: 1
            } );
        }, 200 );
 
        $('#popup_mask').unbind("click");
        $('#popup_mask').bind("click", function(){
            $('#popup_mask').hide();
            var $clopop = $("#pop_win");
            $("#common_ask_div_sc").css("display","none");
            $clopop.css( {
                opacity: 0
            } );
            setTimeout( function () {
                $clopop.hide();
            }, 350 );
            return false;
        });
    }    

</script>
                        <div class="clear">
                        </div>
                    </div>                   
                
            </div>
            <div id="side">
    <div class="side">
<div id="panel_Profile" class="panel">
<ul class="panel_head"><span>个人资料</span></ul>
<ul class="panel_body profile">
<div id="blog_userface">
    <a href="http://my.csdn.net/qinjuning" target="_blank">
    <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/1_qinjuning.jpg" title="访问我的空间" style="max-width:90%">
    </a>
    <br>
    <span><a href="http://my.csdn.net/qinjuning" class="user_name" target="_blank">qinjuning</a></span>
</div>
<div class="interact">
<a href="javascript:void(0);" class="attent" id="span_add_follow" title="[加关注]" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_guanzhu&#39;])"></a>

 <a href="javascript:void(0);" class="letter" title="[发私信]" onclick="window.open(&#39;http://msg.csdn.net/letters/model?receiver=qinjuning&#39;,&#39;_blank&#39;,&#39;height=350,width=700&#39;);_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_sixin&#39;])"></a>  
</div>
<div id="blog_medal">
                       <div class="ico_expert" onclick="javascript:location=&#39;http://blog.csdn.net/experts/rule.html&#39;" title="CSDN认证专家" style="cursor:pointer;width:54px;height:60px;background:url(&#39;http://c.csdnimg.cn/jifen/images/xunzhang/xunzhang/bokezhuanjiamiddle.png&#39;) no-repeat"></div>
                <div id="bms_box">
                                            <a target="_blank">
                                                    <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/zhuanlandaren.png" onmouseover="m_over_m(this,2)" onmouseout="m_out_m()" alt="1">
                                            </a>
               </div>
</div>
<ul id="blog_rank">
    <li>访问：<span>1243370次</span></li>
    <li>积分：<span>8779</span> </li>    
    <li>等级： <span style="position:relative;display:inline-block;z-index:1">
            <img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/blog6.png" alt="" style="vertical-align: middle;" id="leveImg">
            <div id="smallTittle" style=" position: absolute;  left: -24px;  top: 25px;  text-align: center;  width: 101px;  height: 32px;  background-color: #fff;  line-height: 32px;  border: 2px #DDDDDD solid;  box-shadow: 0px 2px 2px rgba (0,0,0,0.1);  display: none;   z-index: 999;">
            <div style="left: 42%;  top: -8px;  position: absolute;  width: 0;  height: 0;  border-left: 10px solid transparent;  border-right: 10px solid transparent;  border-bottom: 8px solid #EAEAEA;"></div>
            积分：8779 </div>
        </span>  </li>
    <li>排名：<span>第896名</span></li>
</ul>
<ul id="blog_statistics">
    <li>原创：<span>43篇</span></li>
    <li>转载：<span>0篇</span></li>
    <li>译文：<span>3篇</span></li>
    <li>评论：<span>972条</span></li>
</ul>
</ul>
</div>




<div id="custom_column_19787559" class="panel">
<ul class="panel_head"><span>通知</span></ul>
<ul class="panel_body">
<font color="#4169E1" size="3" sytle="bold">本文博客欢迎转载, 请保留出处。谢谢合作</font>
</ul>
</div>

<div id="custom_column_21974228" class="panel">
<ul class="panel_head"><span>武汉Android联盟QQ群</span></ul>
<ul class="panel_body">
Android爱好者QQ群：<font color="red" size="2" sytle="bold">55945620</font> ， 希望热爱武汉Android同胞能够加入。
</ul>
</div><div id="panel_Category" class="panel">
    <ul class="panel_head"><span>博客专栏</span></ul>
    <ul class="panel_body" id="sp_column">
    <table cellpadding="0" cellspacing="0"><tbody><tr>
    <td style="padding:10px 10px 0 0;">
    <a href="http://blog.csdn.net/column/details/qinjuning-and-2.html" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/20120510200112662.jpg" style="width:75px;height:75px;"></a>
    </td>
    <td style="padding:10px 0; vertical-align:top;">
    <a href="http://blog.csdn.net/column/details/qinjuning-and-2.html" target="_blank">Android框架浅析</a>
    <p>文章：10篇</p>
    <span>阅读：518493</span>
    </td>
    </tr></tbody></table>
    <table cellpadding="0" cellspacing="0"><tbody><tr>
    <td style="padding:10px 10px 0 0;">
    <a href="http://blog.csdn.net/column/details/qinjuning-and-1.html" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/20120510195933946.jpg" style="width:75px;height:75px;"></a>
    </td>
    <td style="padding:10px 0; vertical-align:top;">
    <a href="http://blog.csdn.net/column/details/qinjuning-and-1.html" target="_blank">Android技巧拾取</a>
    <p>文章：17篇</p>
    <span>阅读：436738</span>
    </td>
    </tr></tbody></table>
    </ul>
</div>
<div id="panel_Category" class="panel">
<ul class="panel_head"><span>文章分类</span></ul>
<ul class="panel_body">
             <li>
                <a href="http://blog.csdn.net/qinjuning/article/category/861761" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_wenzhangfenlei&#39;]); ">Andoird技巧拾取</a><span>(27)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qinjuning/article/category/1073230" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_wenzhangfenlei&#39;]); ">Andoird框架浅析</a><span>(12)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qinjuning/article/category/1153412" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_wenzhangfenlei&#39;]); ">Java技巧拾取</a><span>(3)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qinjuning/article/category/1090336" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_wenzhangfenlei&#39;]); ">Linux学习笔记</a><span>(1)</span>
            </li>
             <li>
                <a href="http://blog.csdn.net/qinjuning/article/category/958505" onclick="_gaq.push([&#39;_trackEvent&#39;,&#39;function&#39;, &#39;onclick&#39;, &#39;blog_articles_wenzhangfenlei&#39;]); ">总结:难得糊涂</a><span>(3)</span>
            </li>
</ul>
</div><div id="hotarticls" class="panel">
<ul class="panel_head">
    <span>       
阅读排行    </span>
</ul>

<ul class="panel_body itemlist">
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7110211" title="Android中View绘制流程以及invalidate()等相关方法分析">Android中View绘制流程以及invalidate()等相关方法分析</a><span>(136632)</span>
</li>
<li>
<a href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET.html" title="Android中Context详解 ---- 你所不知道的Context">Android中Context详解 ---- 你所不知道的Context</a><span>(123799)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7505703" title="Android框架浅析之锁屏(Keyguard)机制原理">Android框架浅析之锁屏(Keyguard)机制原理</a><span>(87548)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/6867806" title="Android中获取应用程序(包)的信息-----PackageManager的使用(一)">Android中获取应用程序(包)的信息-----PackageManager的使用(一)</a><span>(85228)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/6710003" title="Android中Preference的使用以及监听事件分析">Android中Preference的使用以及监听事件分析</a><span>(56760)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7247126" title="Android中滑屏初探 ---- scrollTo 以及 scrollBy方法使用说明">Android中滑屏初探 ---- scrollTo 以及 scrollBy方法使用说明</a><span>(45023)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7419207" title="Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解">Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解</a><span>(42317)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7226787" title="Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起">Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起</a><span>(42217)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/6936783" title="Andriod中绘(画)图----Canvas的使用详解">Andriod中绘(画)图----Canvas的使用详解</a><span>(39099)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7009824" title="Android中获取正在运行的应用程序-----ActivityManager.RunningAppProcessInfo类详解">Android中获取正在运行的应用程序-----ActivityManager.RunningAppProcessInfo类详解</a><span>(38862)</span>
</li>
</ul>
</div>
<div id="hotarticls2" class="panel">
<ul class="panel_head"><span>评论排行</span></ul>
<ul class="panel_body itemlist">
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7110211" title="Android中View绘制流程以及invalidate()等相关方法分析">Android中View绘制流程以及invalidate()等相关方法分析</a><span>(101)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7419207" title="Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解">Android中滑屏实现----手把手教你如何实现触摸滑屏以及Scroller类详解</a><span>(63)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7098986" title="毕业半年，点滴在心中">毕业半年，点滴在心中</a><span>(61)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/6867806" title="Android中获取应用程序(包)的信息-----PackageManager的使用(一)">Android中获取应用程序(包)的信息-----PackageManager的使用(一)</a><span>(59)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7505703" title="Android框架浅析之锁屏(Keyguard)机制原理">Android框架浅析之锁屏(Keyguard)机制原理</a><span>(58)</span>
</li>
<li>
<a href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET.html" title="Android中Context详解 ---- 你所不知道的Context">Android中Context详解 ---- 你所不知道的Context</a><span>(57)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/6892054" title="Android中获取应用程序(包)的大小-----PackageManager的使用(二)">Android中获取应用程序(包)的大小-----PackageManager的使用(二)</a><span>(51)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7416208" title="Android学习进阶路线导航线路(Android源码分享)">Android学习进阶路线导航线路(Android源码分享)</a><span>(47)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7247126" title="Android中滑屏初探 ---- scrollTo 以及 scrollBy方法使用说明">Android中滑屏初探 ---- scrollTo 以及 scrollBy方法使用说明</a><span>(39)</span>
</li>
<li>
<a href="http://blog.csdn.net/qinjuning/article/details/7226787" title="Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起">Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起</a><span>(38)</span>
</li>
</ul>
</div>
<div id="panel_Archive" class="panel">
<ul class="panel_head"><span>文章存档</span></ul>
<ul class="panel_body">
<div id="archive_list"><li><a href="http://blog.csdn.net/qinjuning/article/month/2014/12">2014年12月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2013/04">2013年04月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2013/03">2013年03月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2013/01">2013年01月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/11">2012年11月</a><span>(1)</span></li><span class="hidelist" style="display:none;"><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/10">2012年10月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/09">2012年09月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/07">2012年07月</a><span>(1)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/05">2012年05月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/04">2012年04月</a><span>(3)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/03">2012年03月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/02">2012年02月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2012/01">2012年01月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2011/12">2011年12月</a><span>(4)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2011/11">2011年11月</a><span>(6)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2011/10">2011年10月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2011/09">2011年09月</a><span>(2)</span></li><li><a href="http://blog.csdn.net/qinjuning/article/month/2011/08">2011年08月</a><span>(3)</span></li></span><div id="archive_list_button" class="list_closed">展开</div></div>
</ul>
</div>
<div id="newcomments" class="panel">
<ul class="panel_head"><span>最新评论</span></ul>
<ul class="panel_body itemlist">
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7607214#comments">JNI学习积累之三 ---- 操作JNI函数以及复杂对象传递</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/gordge" class="user_name">gordge</a>:
写得很好，看了受益匪浅
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/8051811#comments">Android中measure过程、WRAP_CONTENT详解以及xml布局文件解析流程浅析(上)</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/Amy_foreverlove" class="user_name">Amy_foreverlove</a>:
@zjc198805:类似的错误太多了
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/6892054#comments">Android中获取应用程序(包)的大小-----PackageManager的使用(二)</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/sinat_24499499" class="user_name">sinat_24499499</a>:
多谢楼主
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7310620#comments">Android中Context详解 ---- 你所不知道的Context</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/taozuiqizhong" class="user_name">taozuiqizhong</a>:
好厉害
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7110211#comments">Android中View绘制流程以及invalidate()等相关方法分析</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/u010074054" class="user_name">u010074054</a>:
楼主您好，看到您写的这篇文章非常好，就忍不住转发了，我已经表明出处了
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7957858#comments">Android中View绘制优化二一----  使用&lt;include /&gt;标签复用布局文件</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/andywuchuanlong" class="user_name">andywuchuanlong</a>:
学习了
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7972991#comments">Android中View绘制优化之三----   优化View</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/andywuchuanlong" class="user_name">andywuchuanlong</a>:
学习了
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7726093#comments">Android中蓝牙的基本使用----BluetoothAdapter类简介</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/grandjan" class="user_name">grandjan</a>:
一针见血  谢谢楼主！
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7226787#comments">Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/u014471160" class="user_name">sdgasgsdfas</a>:
感谢楼主，谢的很仔细
    </p>
    </li>
    <li>
   
         <a href="http://blog.csdn.net/qinjuning/article/details/7416208#comments">Android学习进阶路线导航线路(Android源码分享)</a>
    <p style="margin:0px;"><a href="http://blog.csdn.net/d342784178" class="user_name">d342784178</a>:
3.进阶 补充下嘛
    </p>
    </li>
</ul>
</div>
    </div>
    <div class="clear">
    </div>
</div>

            <div class="clear">
            </div>
        </div>
        

<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/cnick.js"></script>
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/newblog.min.js"></script>


<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/showblogmedal.ashx"></script>
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/JavaScript1.js"></script><link rel="stylesheet" type="text/css" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/pub_footer_2014.css"><div class="pub_fo"><div id="pub_footerall" class="pub_footer_new"><dl><dt></dt> <dd class="foot_sub_menu"><a href="http://www.csdn.net/company/about.html" target="_blank">公司简介</a><span>|</span><a href="http://www.csdn.net/company/recruit.html" target="_blank">招贤纳士</a><span>|</span><a href="http://www.csdn.net/company/marketing.html" target="_blank">广告服务</a><span>|</span><a href="http://www.csdn.net/company/account.html" target="_blank">银行汇款帐号</a><span>|</span><a href="http://www.csdn.net/company/contact.html" target="_blank">联系方式</a><span>|</span><a href="http://www.csdn.net/company/statement.html" target="_blank">版权声明</a><span>|</span><a href="http://www.csdn.net/company/layer.html" target="_blank">法律顾问</a><span>|</span><a href="mailto:webmaster@csdn.net">问题报告</a><span>|</span><a target="_blank" href="http://www.csdn.net/friendlink.html">合作伙伴</a><span>|</span><a href="http://bbs.csdn.net/forums/Service" target="_blank">论坛反馈</a></dd><dd class="foot_contact"><a href="http://wpa.qq.com/msgrd?v=3&uin=2355263776&site=qq&menu=yes" target="_blank" class="qq">网站客服</a><a href="http://wpa.qq.com/msgrd?v=3&uin=2251809102&site=qq&menu=yes" target="_blank" class="qq">杂志客服</a><a href="http://e.weibo.com/csdnsupport/profile" target="_blank" class="weibo">微博客服</a><a href="mailto:webmaster@csdn.net" class="email" title="联系邮箱">webmaster@csdn.net</a><span class="phone" title="服务热线">400-600-2320</span><span class="interval">|</span><span>北京创新乐知信息技术有限公司 版权所有</span><span class="interval">|</span><span>江苏乐知网络技术有限公司 提供商务支持</span></dd><dd class="foot_copyright"><span>京&nbsp;ICP&nbsp;证&nbsp;070598&nbsp;号</span><span class="interval">|</span><span>Copyright © 1999-2014, CSDN.NET, All Rights Reserved&nbsp;</span><a href="http://www.hd315.gov.cn/beian/view.asp?bianhao=010202001032100010" target="_blank"><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/gongshang_logos.gif" alt="GongshangLogo" title=""></a></dd></dl></div></div><div id="note1" class="csdn_note" style="display:none; position:absolute; z-index:9999; width:440px">  <span class="notice_top_arrow"><span class="inner"></span></span>  <div class="box"></div></div><div class="csdn_notice_tip" style="display: none; position: absolute; z-index: 9990; width: 170px;">  <iframe src="about:blank" frameborder="0" scrolling="no" style="z-index:-1;position:absolute;top:0;left:0;width:100%;height:100%;background:transparent"></iframe>  <div class="tip_text">您有<strong>0</strong>条新通知</div>  <a href="javascript:void 0" class="close2"></a></div><script id="noticeScript" type="text/javascript" btnid="header_notice_num" wrapid="note1" count="5" subcount="5" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/notify.js"></script>

    <script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/login.js"></script>
<script type="text/javascript">document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</script><img src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/pv.aspx" border="0" width="0" height="0">
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/counter.js"></script><script type="text/javascript" charset="UTF-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/msg.popup.js"></script>
<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ad-blog.js"></script><script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ad-ms1383.js"></script>

<script type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/count.js"></script><iframe src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/logs.html" frameborder="0" width="0" height="0"></iframe>
<script type="text/javascript">
    $(function () {
        function __get_code_toolbar(snippet_id) {
            return $("<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "' target='_blank' title='在CODE上查看代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a>"
                    + "<a href='https://code.csdn.net/snippets/"
                    + snippet_id
                    + "/fork' target='_blank' title='派生到我的代码片'  style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a>");
        }
        
        $("[code_snippet_id]").each(function () {
            __s_id = $(this).attr("code_snippet_id");
            if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
                __code_tool = __get_code_toolbar(__s_id);
                $(this).prev().find(".tools").append(__code_tool);
            }
        });
    });
</script>




    </div><input type="hidden" id="aa_g_data_ids">
      <!--new top-->
    
    <script id="csdn-toolbar-id" btnid="header_notice_num" wrapid="note1" count="5" subcount="5" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/toolbar.js"></script>
     <!--new top-->
   
    <link href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ask_float_block.css" type="text/css" rel="stylesheet">
    <script language="JavaScript" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/wmd.js"></script>
    <script language="JavaScript" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/showdown.js"></script>
    <script language="JavaScript" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/prettify.js"></script>
    <script language="JavaScript" type="text/javascript" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ask_float_block.js"></script>



<div id="tag-suggest-pop">
  <div class="relative">
    <div class="close"></div>
    <div class="content"></div>
  </div>
</div><link rel="stylesheet" type="text/css" media="screen" href="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/ask_float_fonts_css-6b30a53970eb5c3a2a045e3df585b475.css"><div data-mod="popu_64" class="tracking-ad" chg-blk="0"><a id="com-appcode-float-block" href="http://www.csdn.net/app/" target="_blank" title="APP二维码" style="top:210px"><span id="appcode-close"></span></a><a id="com-app-float-block" href="http://www.csdn.net/app/" title="APP下载" style="top:294px"></a><a id="com-quick-reply" title="快速回复" style="top:332px"></a><a id="com-d-top-a" style="top: 370px; display: block;" title="返回顶部" onclick=""></a> </div><div class="pop_edit ask_second comm_ask_second"><h3>提问</h3><span class="ask_float_span">您的问题将会被发布在“<a class="ask_float_channel" href="http://ask.csdn.net/" target="_blank" style="cursor:pointer">技术问答</a>”频道</span><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" nodetype="close" class="close">×</a><div class="context"><div class="err_div"><span class="err_ico"></span><span class="err_txt">该问题已存在，请勿重复提问</span></div><div class="input_div"><input id="askInputSecond" type="text" style="font-size:14px;" placeholder="问题标题"></div><div class="cm_box"><div class="cm_dialog"></div> <div class="pop_cm cm_add_link"><input type="text" placeholder="链接内容" id="af_cm_link_txt"><input type="text" placeholder="链接地址" id="af_cm_link_url"><input type="text" placeholder="链接提示" id="af_cm_link_tit"><div class="text-right"><span class="btn btn-default btn-sm" id="add_link_btn">插入链接</span> </div> </div><div class="pop_cm cm_add_img"><div class="nav-tabs"><a class="img_tab active" href="http://blog.csdn.net/qinjuning/article/details/7310620#tab_upload">本地上传</a><a class="img_tab" href="http://blog.csdn.net/qinjuning/article/details/7310620#tab_weburl">网络图片</a></div><div class="tab_panel active" id="tab_upload"><div class="set_img"><iframe src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/upload.html"></iframe></div></div><div class="tab_panel" id="tab_weburl"><input type="text" placeholder="图片地址" id="af_cm_img_url"><input type="text" placeholder="图片说明" id="af_cm_img_alt"><div class="text-right"><span class="btn btn-default btn-sm" id="add_img_btn">插入图片</span> </div></div> </div></div> <textarea id="editor_all" rows="8" style="display: none;"></textarea><div class="editor-toolbar"><i class="separator">|</i><a class="icon-headline" title="标题一（Ctrl+Alt+1）"></a><a class="icon-heading" title="标题二（Ctrl+Alt+2）"></a><a class="icon-bold" title="粗体（Ctrl+B）"></a><a class="icon-italic" title="斜体（Ctrl+I）"></a><i class="separator">|</i><a class="icon-quote-left" title="引用（Ctrl+’）"></a><a class="icon-code" title="插入代码片（Ctrl+,）"></a><a class="icon-list-ul" title="无序列表（Ctrl+L）"></a><a class="icon-list-ol" title="有序列表（Ctrl+Alt+L）"></a><i class="separator">|</i><a class="icon-link" title="添加链接（Ctrl+K）"></a><a class="icon-picture" title="添加图片（Ctrl+Alt+I）"></a><i class="separator">|</i><a class="icon-reply" title="撤退（Ctrl+Z）"></a><a class="icon-share-alt" title="前进（Ctrl+Shift+Z）"></a><i class="separator">|</i><a class="icon-info" href="http://ask.csdn.net/pages/markdown" target="_blank" title="markdown语法参考"></a><a class="icon-preview" title="预览"></a><i class="separator">|</i></div><div class="CodeMirror cm-s-paper CodeMirror-focused"><div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; padding: 0px; width: 1000px; height: 1em; outline: none; font-size: 4px;"></textarea></div><div class="CodeMirror-hscrollbar"><div style="height: 1px;"></div></div><div class="CodeMirror-vscrollbar"><div style="width: 1px;"></div></div><div class="CodeMirror-scrollbar-filler"></div><div class="CodeMirror-gutter-filler"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="min-width: 33px;"><div style="position: relative;"><div class="CodeMirror-lines"><div style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre>&nbsp;<span style="display: inline-block; width: 1px; margin-right: -1px;">&nbsp;</span></pre></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code"></div><div class="CodeMirror-cursor" style="visibility: hidden;">&nbsp;</div><div class="CodeMirror-cursor CodeMirror-secondarycursor" style="visibility: hidden;">&nbsp;</div></div></div></div></div><div style="position: absolute; height: 30px; width: 1px;"></div><div class="CodeMirror-gutters" style="display: none;"></div></div></div><div class="editor-statusbar"><span class="lines">0</span><span class="words">0</span><span class="cursor">0:0</span></div><div class="div_tags clearfix"><div id="divSearchTags" class="tags_con"><input type="text"></div><input type="hidden" name="txtSearchTags"></div><div id="ask2_tagRecomm_div" class="drt_tagRecomm tracking-ad" data-mod="popu_73"><span class="drt_tit">推荐标签：</span></div></div><div class="success"><div class="left_area"><input id="chk_cb" type="checkbox"><span class="wyxs">我要悬赏</span><input id="cb_num" class="cb_num" readonly="true"><span class="phib_rii"><span> 币</span></span></div><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" nodetype="cancel" class="cancel">取消</a><a href="http://blog.csdn.net/qinjuning/article/details/7310620#" nodetype="ok" class="ok">发布</a></div></div><div id="common_ask_div_sc" class="searchContainer"><div class="sTitle">可能存在类似的问题：</div><div class="sFooter"><a class="sFirstNewAsk">我想提一个新问题</a></div></div><iframe src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/cisco-article-innerpage-pip-300-250-30k.html" style="width: 1px; height: 1px; position: absolute; visibility: hidden;"></iframe><style type="text/css" id="xnSmartBarCacheCSSID">

.baiduServiceBottomBar.noDis{display:none !important}.baiduServiceBottomBar.iphoneDevice>ul>li .count{font-size:10px;line-height:12px;height:12px;padding:0px 2px;top:-3px;right:-8px;box-sizing:border-box;font-family:Arial, Helvetica, sans-serif;text-shadow:none;outline:none}.baiduServiceBottomBar.hackIFrame iframe{top:0px;-webkit-transform:translateZ(5px);transform:translateZ(5px)}.baiduServiceBottomBar{overflow:visible;line-height:1;border-top:1px solid #c0c0c0;position:fixed;z-index:10001;width:100%;bottom:0px;background-color:rgba(242,242,242,0.94);background-image:-moz-linear-gradient(rgba(248,248,248,0.94), rgba(242,242,242,0.94));background-image:-o-linear-gradient(rgba(248,248,248,0.94), rgba(242,242,242,0.94));background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, rgba(248,248,248,0.94)), color-stop(1, rgba(242,242,242,0.94)));background-image:-webkit-linear-gradient(rgba(248,248,248,0.94), rgba(242,242,242,0.94));background-image:-ms-linear-gradient(rgba(248,248,248,0.94), rgba(242,242,242,0.94));background-image:linear-gradient(rgba(248,248,248,0.94), rgba(242,242,242,0.94))}.baiduServiceBottomBar div{overflow:visible}.baiduServiceBottomBar div,.baiduServiceBottomBar span,.baiduServiceBottomBar object,.baiduServiceBottomBar iframe,.baiduServiceBottomBar h1,.baiduServiceBottomBar h2,.baiduServiceBottomBar h3,.baiduServiceBottomBar h4,.baiduServiceBottomBar h5,.baiduServiceBottomBar h6,.baiduServiceBottomBar p,.baiduServiceBottomBar a,.baiduServiceBottomBar em,.baiduServiceBottomBar img,.baiduServiceBottomBar b,.baiduServiceBottomBar i,.baiduServiceBottomBar dl,.baiduServiceBottomBar dt,.baiduServiceBottomBar dd,.baiduServiceBottomBar ol,.baiduServiceBottomBar ul,.baiduServiceBottomBar li,.baiduServiceBottomBar fieldset,.baiduServiceBottomBar form,.baiduServiceBottomBar label,.baiduServiceBottomBar table,.baiduServiceBottomBar caption,.baiduServiceBottomBar tbody,.baiduServiceBottomBar tfoot,.baiduServiceBottomBar thead,.baiduServiceBottomBar tr,.baiduServiceBottomBar th,.baiduServiceBottomBar td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline}.baiduServiceBottomBar p,.baiduServiceBottomBar div,.baiduServiceBottomBar h1,.baiduServiceBottomBar h2,.baiduServiceBottomBar h3,.baiduServiceBottomBar h4,.baiduServiceBottomBar h5,.baiduServiceBottomBar h6{-webkit-text-size-adjust:none}.baiduServiceBottomBar ul,.baiduServiceBottomBar li,.baiduServiceBottomBar a{vertical-align:middle}.baiduServiceBottomBar ol,.baiduServiceBottomBar ul{list-style:none;overflow:visible}.baiduServiceBottomBar .qingIcon{width:22px;height:22px;background-image:url("");margin:10px auto;background-size:100% 100%}.baiduServiceBottomBar .qingBtn{width:48px;height:48px;background-color:#f8f8f8;border:1px solid #ddd}.baiduServiceBottomBar .qingIcon,.baiduServiceBottomBar .qingBtn{display:block}.baiduServiceBottomBar .baiduServiceBarFullScreanMask{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);-webkit-transform:scale(1);z-index:100000}.baiduServiceBottomBar .baiduServiceBarPopupContainer{position:fixed;z-index:100001;top:50%;left:50%;width:200px;height:225px;border-radius:5px;margin-left:-100px;margin-top:-125px;background:url("") 50% top #f8f8f8 no-repeat;background-size:105px 120px}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupClose{background-color:rgba(255,255,255,0);background-image:-moz-linear-gradient(#d0d0d0, rgba(255,255,255,0));background-image:-o-linear-gradient(#d0d0d0, rgba(255,255,255,0));background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #d0d0d0), color-stop(1, rgba(255,255,255,0)));background-image:-webkit-linear-gradient(#d0d0d0, rgba(255,255,255,0));background-image:-ms-linear-gradient(#d0d0d0, rgba(255,255,255,0));background-image:linear-gradient(#d0d0d0, rgba(255,255,255,0));position:absolute;right:30px;top:0;height:30px;width:1px;display:inline-block}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupClose:before,.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupClose:after{content:" ";position:absolute;right:-16px;top:7px;width:1px;height:12px;display:inline-block;background:#262626;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupClose:after{-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupCloseBtn{position:absolute;right:0;top:0;height:30px;width:30px}.baiduServiceBottomBar .baiduServiceBarPopupContainer span{width:100%;text-align:center;display:inline-block;position:absolute;top:125px;font-size:16px;color:#666}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupInfo{top:150px;font-size:14px}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer{position:absolute;bottom:0;left:0;width:100%;height:44px;line-height:44px;background:#eee;font-size:16px;color:#262626;border:none;padding:0;border-radius:0 0 5px 5px;border-top:1px solid #d8d8d8}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer a{float:left;text-align:center;border:none;padding:0px;margin:0;padding-left:15px;display:inline-block;width:50%;height:42px}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer .baiduServiceBarPopupTel{background:url("") 27% 50% no-repeat;background-size:13px 15px}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer .baiduServiceBarPopupTel:only-child{background-position:40% 50%;width:100%}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer .baiduServiceBarPopupConsult{background:url("") 25% 50% no-repeat;background-size:14px 14px}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer .baiduServiceBarPopupConsult:only-child{background-position:40% 50%;width:100%}.baiduServiceBottomBar .baiduServiceBarPopupContainer .baiduServiceBarPopupBottomContainer .baiduServiceBarPopupTel+.baiduServiceBarPopupConsult{border-left:1px solid #d8d8d8}.baiduServiceBottomBar *{vertical-align:middle;box-sizing:border-box}.baiduServiceBottomBar .baidu-xn-pop-parent{position:relative}.baiduServiceBottomBar .baidu-xn-pop-container{position:absolute;bottom:100%;display:none;z-index:-90;width:113%;background-color:rgba(255,255,255,0.94);background-image:-moz-linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94));background-image:-o-linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94));background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, rgba(255,255,255,0.94)), color-stop(1, rgba(255,255,255,0.94)));background-image:-webkit-linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94));background-image:-ms-linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94));background-image:linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94));left:initial !important;margin-left:-7px;border:1px solid #c0c0c0;border-radius:2px;box-shadow:0px 0px 4px 1px rgba(0,0,0,0.12);margin-bottom:12px;-webkit-transform:scale(1)}.baiduServiceBottomBar .baidu-xn-pop-container ul,.baiduServiceBottomBar .baidu-xn-pop-container li{list-style:none}.baiduServiceBottomBar .baidu-xn-pop-container ul{padding:0px 9px;height:auto}.baiduServiceBottomBar .baidu-xn-pop-container ul>li:not(:last-of-type){border-bottom:1px solid #dddddd}.baiduServiceBottomBar .baidu-xn-pop-container li.vote{height:43px}.baiduServiceBottomBar .baidu-xn-pop-container ul>li{height:36px}.baiduServiceBottomBar .baidu-xn-pop-container ul>li a{padding:1px 0;font-size:14px}.baiduServiceBottomBar .baidu-xn-pop-container.show,.baiduServiceBottomBar .show>.baidu-xn-pop-container{display:block;z-index:-90}.baiduServiceBottomBar .noDis{display:none !important}.baiduServiceBottomBar a{text-decoration:none;color:#001526}.baiduServiceBottomBar>ul{display:-webkit-box;display:-ms-flexbox;display:-moz-box;display:box;width:100%;list-style-type:none;padding:0px;margin:0px;-webkit-box-pack:center;-webkit-box-align:center;box-pack:center;box-align:center;border:0 #fafafb solid;border-width:1px 0 0 1px}.baiduServiceBottomBar>ul>li{display:block;width:3em;-webkit-box-flex:1;flex:1;-ms-flex:1;-moz-box-flex:1;text-align:center;font-size:10px}.baiduServiceBottomBar>ul>li a{font-size:16px;padding:6px 0px 4px;display:inline-block;display:inline-block;width:100%;line-height:34px;height:43px;text-align:center}.baiduServiceBottomBar>ul>li a p>span.text-char{text-shadow:0 1px #fff}.baiduServiceBottomBar>ul>li .icon{width:18px;height:18px;display:block;margin:0px auto 4px;background-size:100% 100%;vertical-align:middle;position:relative}.baiduServiceBottomBar>ul>li .count-outer{position:relative;width:auto;display:inline-block;line-height:inherit}.baiduServiceBottomBar>ul>li .count{background-color:#f43b3b;color:#fff;border-radius:1px;padding:0px 2px;position:absolute;font-size:10px;line-height:12px;height:12px;top:-3px;right:-10px;font-style:normal;text-shadow:none;outline:none}.baiduServiceBottomBar>ul>li .baidu-xn-pop-container .count{top:3px}.baiduServiceBottomBar>ul li.showMoreBtn{display:none;position:relative}.baiduServiceBottomBar>ul .comment .count{right:-9px}.baiduServiceBottomBar>ul .pop-tip{-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg);width:6px;height:6px;z-index:300;top:-15px;left:-55%;position:absolute;border:1px solid #c0c0c0;background-color:rgba(255,255,255,0.94);display:none}.baiduServiceBottomBar>ul .pop-tip.align-right{margin-left:100%;border-left:0px;border-top:0px}@media only screen and (max-width: 400px){.baiduServiceBottomBar .show-more-buttons>li:nth-of-type(n+4),.baiduServiceBottomBar .show-more-buttons-lg>li:nth-of-type(n+4){display:none}.baiduServiceBottomBar .show-more-buttons>li.showMoreBtn,.baiduServiceBottomBar .show-more-buttons-lg>li.showMoreBtn{display:block}}@media only screen and (min-width: 400px) and (max-width: 480px){.baiduServiceBottomBar .show-more-buttons-lg>li:nth-of-type(n+5){display:none}.baiduServiceBottomBar .show-more-buttons-lg>li.showMoreBtn{display:block}}@media only screen and (max-device-width: 600px){.baiduServiceBottomBar #mobile-phone-detector{display:block}}.baiduServiceBottomBar [data-action=ecomBottomBar-vote]{position:relative}.baiduServiceBottomBar [data-action=ecomBottomBar-vote] .bd_vote{position:absolute;z-index:1;height:100%;width:100%;top:0px}.baiduServiceBottomBar [data-action=ecomBottomBar-vote] .text-char{display:inline-block;-webkit-transform:translateZ(0px);transform:translateZ(0px)}.baiduServiceBottomBar [data-action=ecomBottomBar-vote] .bd_vote iframe{position:relative}.baiduServiceBottomBar>ul>li:last-of-type .baidu-xn-pop-container{right:10px}.baiduServiceBottomBar>ul>li:first-of-type .baidu-xn-pop-container{left:8px !important;margin-left:0px}.baiduServiceBottomBar .baidu-xn-pop-parent:after{position:absolute;top:0px;left:50%;width:12px;height:3px;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #c0c0c0;border-left:0px;border-right:0px;margin:6px 0px 6px -6px;content:""}.baiduServiceBottomBar .qingBtn{display:none}.baiduServiceBottomBar.showQingIconStyle.hideContent{border-top:transparent;width:auto}.baiduServiceBottomBar.showQingIconStyle.hideContent .qingBtn{display:block}.baiduServiceBottomBar.showQingIconStyle.hideContent .icon-container{display:none}.baiduServiceBottomBar.showQingIconStyle{display:-webkit-box;display:-ms-flexbox;display:-moz-box;-webkit-box-pack:center;-webkit-box-align:center;box-pack:center;box-align:center}.baiduServiceBottomBar.showQingIconStyle .qingBtn{display:block}.baiduServiceBottomBar.showQingIconStyle>ul>li:first-of-type .baidu-xn-pop-container{left:initial !important;margin-left:-10%}.baiduServiceBottomBar.showQingIconStyle [data-action=ecomBottomBar-showMore]{max-width:50px}.baiduServiceBottomBar.showQingIconStyle [data-action=ecomBottomBar-showMore] .baidu-xn-pop-container{width:180%}.baiduServiceBottomBar.showQingIconStyle [data-action=ecomBottomBar-showMore] .pop-tip.align-right{margin-left:120%}.baiduServiceBottomBar.showQingIconStyle.showContent{width:100%}.baiduServiceBottomBar.showQingIconStyle.showContent .qingBtn{border:1px solid transparent;border-right:1px solid #cdcdcd}.baiduServiceBottomBar.showQingIconStyle.showContent .qingIcon{background-image:url()}.baiduServiceBottomBar.showQingIconStyle.showContent .icon-container{display:-webkit-box;display:-ms-flexbox;display:-moz-box;dislay:box;-webkit-box-flex:1;flex:1;-ms-flex:1;-moz-box-flex:1}.baiduServiceBottomBar.double-scale>ul>li a{line-height:68px;height:86px;font-size:32px;padding:12px 0 4px}.baiduServiceBottomBar.double-scale>ul>li .baidu-xn-pop-container{width:113%}.baiduServiceBottomBar.double-scale>ul>li .baidu-xn-pop-container ul{padding:0px 18px}.baiduServiceBottomBar.double-scale>ul>li .baidu-xn-pop-container ul>li{height:72px;line-height:60px;width:100%}.baiduServiceBottomBar.double-scale>ul>li .baidu-xn-pop-container ul>li a{padding:0px;line-height:72px;height:72px}.baiduServiceBottomBar.double-scale>ul>li .count{font-size:20px;line-height:20px;height:20px;padding:0 6px;top:6px;right:-20px;text-shadow:none;outline:none;border-radius:4px}.baiduServiceBottomBar.double-scale .baidu-xn-pop-parent:after{width:24px;height:6px;margin:12px 0 12px -12px;content:""}@media only screen and (max-width: 800px){.baiduServiceBottomBar.double-scale .show-more-buttons>li:nth-of-type(n+4),.baiduServiceBottomBar.double-scale .show-more-buttons-lg>li:nth-of-type(n+4){display:none}.baiduServiceBottomBar.double-scale .show-more-buttons>li.showMoreBtn,.baiduServiceBottomBar.double-scale .show-more-buttons-lg>li.showMoreBtn{display:block}}@media only screen and (min-width: 800px) and (max-width: 960px){.baiduServiceBottomBar.double-scale .show-more-buttons-lg>li:nth-of-type(n+5){display:none}.baiduServiceBottomBar.double-scale .show-more-buttons-lg>li.showMoreBtn{display:block}}.smb-user-guide-wrapper{position:fixed;z-index:9999;background:rgba(15,15,15,0.8);top:83px;width:238px;height:195px;left:50%;margin-left:-119px;border-radius:10px;font-size:14px;font-family:sans-serif}.smb-user-guide-wrapper .bg-pic{margin-top:24px;height:131px;background:url(//m.baidu.com/static/search/siteapp/lego/use_guide.png) center no-repeat;background-size:208px 131px}.smb-user-guide-wrapper .queryX{position:absolute;left:44px;top:90px}.smb-user-guide-wrapper .closeX{display:block;margin:8px auto;color:#fff;width:110px;height:25px;line-height:25px;text-align:center}.baiduServiceBarPopupShow .baiduServiceBarFullScreanMask,.baiduServiceBarPopupShow .baiduServiceBarPopupContainer{display:block}.baiduServiceBarFullScreanMask,.baiduServiceBarPopupContainer,.baiduServiceBarPopupHideLeft .baiduServiceBarFullScreanMask,.baiduServiceBarPopupHideRight .baiduServiceBarFullScreanMask{display:none}.baiduServiceBarPopupHideLeft .baiduServiceBarPopupContainer,.baiduServiceBarPopupHideRight .baiduServiceBarPopupContainer{animation-duration:1s;-webkit-animation-duration:1s;-webkit-animation-name:fadeOutDownRight;animation-name:fadeOutDownRight;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;transition:All 1s ease-in-out;-webkit-transition:All 1s ease-in-out}.baiduServiceBarPopupHideLeft .baiduServiceBarPopupContainer{-webkit-animation-name:fadeOutDownLeft;animation-name:fadeOutDownLeft}@-webkit-keyframes fadeOutDownLeft{0%{opacity:1}30%{opacity:.8;-webkit-transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0);transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0)}100%{opacity:0;top:100%;left:5%;-webkit-transform:rotate(45deg) scale3d(0.1, 0.1, 0.1)}}@keyframes fadeOutDownLeft{0%{opacity:1}30%{opacity:.8;-webkit-transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0);transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0)}100%{opacity:0;top:100%;left:5%;-webkit-transform:rotate(45deg) scale3d(0.1, 0.1, 0.1)}}@-webkit-keyframes fadeOutDownRight{0%{opacity:1}30%{opacity:.8;-webkit-transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0);transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0)}100%{opacity:0;top:100%;left:95%;-webkit-transform:rotate(-45deg) scale3d(0.1, 0.1, 0.1)}}@keyframes fadeOutDownRight{0%{opacity:1}30%{opacity:.8;-webkit-transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0);transform:scale3d(0.1, 0.1, 0.1) translate3d(0, 0px, 0)}100%{opacity:0;top:100%;left:95%;-webkit-transform:rotate(-45deg) scale3d(0.1, 0.1, 0.1)}}.baiduServiceBottomBar-toast-container{position:fixed;z-index:99999999;width:100%;bottom:50px;text-align:center}.baiduServiceBottomBar-toast-container .toast-text{min-width:40%;max-width:80%;overflow:hidden;word-break:break-all;word-wrap:nowrap;text-overflow:ellipsis;background-color:rgba(0,0,0,0.75);opacity:0;-webkit-transition:opacity 2s linear 0s;border-radius:5px;color:#fff;padding:10px;margin:0px auto;font-size:16px}.baiduServiceBottomBar-toast-container.show .toast-text{opacity:1}.baiduServiceBottomBar-toast-container.noDis{display:none !important}body,html{padding:0px;margin:0px}

/**
 * 用于将 css 以内联 js 的形式插入到页面中去
 */
</style><script type="text/javascript" charset="utf-8" src="http://127.0.0.1:7777/getcuid?callback=xnJSONP059602" defer=""></script><div class="baiduServiceBottomBar noDis"><a class="qingBtn" data-action="ecomBottomBar-iconBtn" onclick="javascript:void(0);"><i class="qingIcon"></i></a><ul class="showCount-3 icon-container"><li><a data-action="ecomBottomBar-comment" onclick="javascript:void(0);" class="hackTJMark"><p class="count-outer"><span class="text-char">评价</span><span class="count" style="right: 0px;">21</span></p></a></li><li><a data-action="qingBottomBarShare" onclick="javascript:void(0);"><p class="count-outer"><span class="text-char">分享</span><span class="count noDis"></span></p></a></li><li><a data-action="ecomBottomBar-vote" onclick="javascript:void(0);"><p class="count-outer"><span class="text-char">赞</span><span class="count" style="right: 0px;">234</span></p><div class="bd_vote" data-inited="1"><iframe id="vote143686419348580" style="border: none; width: 100%; height: 100%; display: block;" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/like.html"></iframe></div></a></li><li class="showMoreBtn baidu-xn-pop-parent" data-action="ecomBottomBar-showMore"><a onclick="javascript:void(0);">更多</a><div class="noDis"><div class="baidu-xn-pop-container"><div class="pop-content"><ul></ul></div></div><div class="pop-tip align-right" style="display: none;"></div></div></li></ul><!-- hack form mobile phone detect --><span id="mobile-phone-detector"></span></div><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/vote.js" async=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(1)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(2)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(3)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(4)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(5)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(6)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(7)" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(8)" defer=""></script><script type="text/javascript" charset="utf-8" src="http://openapi.baidu.com/social/api/2.0/topic/info?callback=xnJSONP1065148&app_id=3629560&third_source_id=3629560" defer=""></script><script type="text/javascript" charset="utf-8" src="./Android中Context详解 ---- 你所不知道的Context - qinjuning、lets go - 博客频道 - CSDN.NET_files/info(9)" defer=""></script></body></html>